Program to remove all the white spaces from a string

Source Code:

public class RemoveSpaces {
public static void main(String[] args) {
String s = “j a v a p r o g r a m”;
String result = s.replaceAll(“\s”, “”);
System.out.println(result);
}
}

Output: