*
The moose likes Beginning Java and the fly likes comparing two enum types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "comparing two enum types " Watch "comparing two enum types " New topic
Author

comparing two enum types

Dounia Kchiere
Greenhorn

Joined: Oct 06, 2006
Posts: 9
Hi all,
I would like to know if I can compare two enu types for compatibility based on the compareTo method in Enum Class or do I have to override it.


Thank you,

Dounia
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
I'm not sure what you mean by comparing enum types for compatability but the compareTo() method inherited by all enum types is final and can't be overridden.


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

I don't think that you can subclass an enumerated type, can you?

-- Kaydell
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: comparing two enum types
 
Similar Threads
Nesting Enums within Enums
Doubt in Rules Roundup switch int only (enum works)
Using multiple enum
enum static methods
What is the usage on enum types?