| Author |
Enums
|
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
|
Do enums extend java.lang.Object?
|
Groovy
|
 |
sanjeevmehra mehra
Ranch Hand
Joined: Aug 21, 2004
Posts: 75
|
|
enum (enumeration) is an interface and interfaces do not extend from Object class. thanks & regards, sanjeev.
|
thanks & regards,<br />Sanjeev.
|
 |
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8876
|
|
Originally posted by sanjeevmehra mehra: enum (enumeration) is an interface and interfaces do not extend from Object class. thanks & regards, sanjeev.
I am talking about enums in java Tiger and not Enumeration interface.
|
 |
somkiat puisungnoen
Ranch Hand
Joined: Jul 04, 2003
Posts: 1312
|
|
Sure, all class MUST extends java.lang.Object.
public abstract class Enum<E extends Enum<E>>extends Objectimplements Comparable<E>, SerializableThis is the common base class of all Java language enumeration types.
|
SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
|
 |
somkiat puisungnoen
Ranch Hand
Joined: Jul 04, 2003
Posts: 1312
|
|
Enum is new feature in Java Tiger (5.0).
Typesafe Enums This flexible object-oriented enumerated type facility allows you to create enumerated types with arbitrary methods and fields. It provides all the benefits of the Typesafe Enum pattern ("Effective Java," Item 21) without the verbosity and the error-proneness. Refer to JSR 201.
|
 |
Mogens Nidding
Ranch Hand
Joined: Mar 08, 2004
Posts: 77
|
|
Yes, enums extend java.lang.Object! In addition, they have high-quality toString, hashCode and equals methods. They are also Serializable and Comparable.
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15229
|
|
The Enum API is always a good place to find answers to questions like this.
|
 |
 |
|
|
subject: Enums
|
|
|