Why Java does not allow overriding equals(Object) in an Enum?

Posted by Ashwin Prabhu on Stack Overflow See other posts from Stack Overflow or by Ashwin Prabhu
Published on 2010-06-03T09:36:21Z Indexed on 2010/06/03 9:44 UTC
Read the original article Hit count: 118

Filed under:
|

@Override public boolean equals( Object otherObject )

is not allowed in Java for an Enum, since the method equals(Object x) is defined as final in Enum. Why is this so?

I cannot thing of any use case which would require overriding equals(Object) for Enum. I'm just curious to know the reasoning behind this behavior.

© Stack Overflow or respective owner

Related posts about java

Related posts about syntax-error