title: How do I remove spaces in a String (sentence)
body: <p>I need to remove all spaces from it. </p>
  
  <p>Eg: This is my code
  O/P : Thisismycode</p>
  
  <p>This is my code so far.  </p>
  
  <pre><code>import java.util.Scanner;
  public class nospace{
  
  public static void main(String args[]){
  
      Scanner s=new Scanner(System.in);
  
      System.out.println("Enter a String");
      String N=s.nextLine();
      N=N.trim();
      N=N+" ";
      int l=N.length();
      int a=0;
      for(int i=0;i&lt;=l-1;i++){
          if(N.charAt(i)==32){
      System.out.println(N.substring(a,i+1));
      }
      a=i;
  
      }
  
  }
  
  }
  </code></pre>
  
  <p>All it does it print the last letters of each word. Any help is appreciated.</p>