remove space from string jav code example Example: remove space string java a = a.replaceAll("\\s+", "");