Last Updated: February 25, 2016
·
1.226K
· 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".