Question: what is difference between ordinal() and compareto() in enum?
Answer: Assuming you've defined them in order of severity, you can compare the ordinals of each value. The ordinal is its position in its enum declaration, where the initial constant is assigned an ordinal of zero. You get the ordinal by calling the ordinal() method of the value. Java enum has already build in compareTo(..)