title: Why do Exception classes in Java NOT implement equals method?
body: <p>Why do <code>Exception</code> classes (like <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/RuntimeException.java" rel="noreferrer">RuntimeException</a>) not implement <code>equals()</code> method?</p>
  
  <p>For example, the <a href="http://ideone.com/Qoyhv3" rel="noreferrer">output</a> for this code is <code>false</code>:</p>
  
  <pre><code>/* Name of the class has to be "Main" only if the class is public. */
  class Ideone
  {
      public static void main (String[] args) throws java.lang.Exception
      {
          final RuntimeException e1 = new RuntimeException("e");
          final RuntimeException e2 = new RuntimeException("e");
          System.out.println(e1.equals(e2));
      }
  }
  </code></pre>
  
  <p>Is there a reason why <code>equals()</code> is not implemented? Seems to me it would be fairly useful.</p>
  
  <p>Edit: Let me expand on the question, since it seems that most people believe an <code>equals()</code> implementation would not be useful. </p>
  
  <p>I would like to know, why Exceptions should be treated differently than normal objects and only be matched if its the same instance. Does it not have enough information about itself to compare with other objects. For example, the underlying <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/StackTraceElement.java#StackTraceElement.equals%28java.lang.Object%29" rel="noreferrer">StackTraceElement</a>, which I presume stores the call stack, already implements an <code>equals</code> method.</p>
  
  <p>Is there something in the definition of Exceptions that stop them from implementing an equals method based on their attributes?</p>