title: Strings concatenation and immutability in Java
body: <p>As <code>String</code> is a immutable object, we cannot change a string. But after running this code, the value of the string will be "HelloWorld". Can anybody please explain the reason for it?</p>
  
  <pre><code>class StringTest
  {
      public static void main(String args[])
      {
          String str1="Hello";
          String str2="World";
          str1=str1+str2;
          System.out.println(str1);
      }
  }
  </code></pre>