Remove Allspaces in the String by replaceAll() Method.

PHOTO EMBED

Mon May 01 2023 11:44:16 GMT+0000 (Coordinated Universal Time)

Saved by @Shankar #instanceblocks #inheritance #overloading

/*
 class removeWhiteSpace {    
    public static void main(String[] args) {    
            
        String str1="Remove white spaces of the String";    
            
        //Removes the white spaces using regex    
        str1 = str1.replaceAll(" ", "");    
            
        System.out.println(str1);    
    }    
}   
*/

class RemoveWhiteSpaces
{
	public static void main(String[] args){
		String str = "Remove white spaces of the String";
		str = str.replaceAll(" ","");
		System.out.println(str);
	}
}
content_copyCOPY