title: Using "==" in Java
body: <pre><code>public class Test { 
      public static void main(String[] args) 
      { 
          String s1 = "HELLO";
          String s2 = "HELLO";
  
          System.out.println(s1 == s2);  // true
      }  
  } 
  </code></pre>
  
  <p>But when I use :</p>
  
  <pre><code>public class Test { 
      public static void main(String[] args) 
      { 
          String s1 = new String("HELLO");
          String s2 = new String("HELLO");
  
          System.out.println(s1 == s2); // false
      } 
  } 
  </code></pre>
  
  <p>Can anybody please explain the difference here? Thankyou!</p>