Complete the following method that takes a string as a the s
     Complete the following method that takes a string as a  the space characters in the string. For example, \"This is a samp  \'\'Thisisasamplestring.\"  public static String Convert(String s)  { 
  
  Solution
RemoveWhiteSpaces.java
import java.util.Scanner;
 class RemoveWhiteSpaces
 {
     public static void main(String[] args)
     {
       String s;
 
       Scanner in = new Scanner(System.in);
 
       System.out.println(\"Enter a string : \");
       s = in.nextLine();
       System.out.println(\"You entered string : \"+s);
     
        String c = Convert(s);
         System.out.println(\"String Without Space : \"+c);
 }
 public static String Convert(String str) {
       String strWithoutSpace = str.replaceAll(\"\\\\s\", \"\");
      return strWithoutSpace;
    }
 }
Output :

