title: String method Append() : StringBuilder vs StringBuffer
body: <p>With this code:</p>
  
  <pre><code>  public static void main(String[] args) {
  
      String s = "Java";
      StringBuilder buffer = new StringBuilder(s);
      change(buffer);
  
         System.out.println("What's strBuf.charAt(5)? " + strBuf.charAt(3));
         System.out.println(buffer);
    }
  
       private static void change(StringBuilder buffer) {
  
            buffer.append(" and HTML");
    }
  </code></pre>
  
  <p>When I run the code using StringBuilder I get  error message</p>
  
  <pre><code> The constructor StringBuilder(String) is undefined
      The method charAt(int) is undefined for the type StringBuilder
  </code></pre>
  
  <p>Tried StringBuffer instead and it works.
  The content of the StringBuffer object is compiled to "Java and Eclipse.." </p>
  
  <pre><code>  public static void main(String[] args) {
  
      String s = "Java";
      StringBuffer strbuf = new StringBuffer(s);
      change(strbuf);
  
                 System.out.println("The Stringbuffer.charAt(5) is ? " + strbuf.charAt(3));
             System.out.println(strbuf);
   }
  
         private static void change(StringBuffer strbuf) {
  
                         strbuf.append(" and Eclipse");
   }
  </code></pre>
  
  <p>}</p>