title: difference in using Intern method in Java
body: <p>This question might be simple just to make sure 100% sure am asking it.. What is the difference between these 2 cases
  Case 1:</p>
  
  <pre><code>String s = "Hello";
  String s2 = new String("Hello");
  s2.intern();
  System.out.println(s == s2);
  </code></pre>
  
  <p>Case 2:</p>
  
  <pre><code>String s = "Hello";
  String s1 = new String("Hello").intern();
  System.out.println(s == s1);
  </code></pre>
  
  <p>Now case 1 prints false and case 2 prints true.</p>
  
  <p>Can some one explain why?</p>