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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "comparing two enum types " Watch "comparing two enum types " New topic

comparing two enum types

Dounia Kchiere

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,

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: 689

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

-- Kaydell
I agree. Here's the link:
subject: comparing two enum types
It's not a secret anymore!