title: Explain me that strings are immutable
body: <p>I read a lot that string objects are immutable and only string buffers are mutable. But When I tried this program. I am confused. So whats going on here in this program.</p>
  
  <pre><code>class Stringss {
      public static void main(String[] args) {
  
          String s="hello";
          String ss=new String("xyz");
          System.out.println(ss);
          System.out.println(s);
  
          s="do";
          ss=new String("hello");
          System.out.println(s);
          System.out.println(ss);
      }
  }
  </code></pre>
  
  <p>Output is </p>
  
  <pre><code>xyz
  hello
  do
  hello
  </code></pre>