title: equals method of Object class - how it works - Java
body: <p>I was wondering how equals method in Object class works. This is the implementation of the method.</p>
  
  <pre><code>public boolean equals(Object obj) {
      return (this == obj);
  }
  </code></pre>
  
  <p>where its evident that equals method is using <code>==</code>.
  So,now when I am comparing two objects a and b, if a happens to be null, it doesn't throw any exception. But <code>a.equals(b)</code>, throws NPE, why?</p>