Can we override compareTo method for Enumerations ?
Javasearch.buggybread.com

Search Interview Questions


 3372 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Java - Interview Questions and Answers

 Q1. Can we override compareTo method for Enumerations ?Core Java
Admin
info@buggybread.com
Ans. No. compareTo method is declared final for the Enumerations and hence cannot be overriden. This has been intentionally done so that one cannot temper with the sorting order on the Enumeration which is the order in which Enum constants are declared.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   compareto   final methods   enum   enumeration      expert


Related Questions

  Enums cannot be declared ..
  What are concepts introduced with Java 5 ?
  enums are intrinsically ..
  What is an Enum type ?
  If I try to add Enum constants to a TreeSet, What sorting order will it use ?
  When were Enums introduced in Java ?
  What is an enumeration?
  Can we extend an Enum ?
  Shall we keep the enumeration name in all capital letters as it contains all constants ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: