Enum Declares compareTo as final
In Java (>1.5) any enum type automatically inherits a Comparable implementation from java.lang.Enum. However the implementation of compareTo is declared as final and thus it is not possible to override it. Thus the only way to compare enum types is via "the order in which the constants are declared".
Written by Jeff Clark
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Java
Authors
Related Tags
#java
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#