title: Using the equals() method with String and Object in Java
body: <pre><code>Object o1 = new Object();
  Object o2 = new Object();
  //o1=o2;
  System.out.println(o1.equals(o2));
  </code></pre>
  
  <p>It returns <code>false</code>. It can return <code>true</code>, if the comment is removed.</p>
  
  <hr>
  
  <p>Why isn't the same thing applicable to the <code>String</code> class?</p>
  
  <pre><code>String s1=new String();
  String s2=new String();
  System.out.println(s1.equals(s2));
  </code></pre>
  
  <p>It returns <code>true</code>. Why? (because <code>String</code> uses interns or something else involved?)</p>