remove space string java

Java
a.replaceAll("\\s+","");a = a.replaceAll("\\s+", "");
Source

Also in Java: