Last Updated: February 25, 2016
· jeffc

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".

Say Thanks
Awesome Job

7648e20a 9797 11e7 9df6 f1c7f530b0ea
Senior Full-Stack Web Developer
Remote (Virginia/US based company)
Full Time