title: How to implement the logic of string trim() method
body: <p>I have tried checking the internal implementation of String trim() , but could not get the complete idea.Can any one please explain the internal behaviour of trim() .I know that it removes the whitespaces.But while executing the below program, white spaces are not removed.</p>
  
  <pre><code>public class test
  {
      public static void main(String [] args){
          String s = "  abd  c  ";
          String s3 = s.trim();
          System.out.println(s3);
      }
  }
  </code></pre>
  
  <p>How to implement the internal logic of trim method...?</p>