File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Enums Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Enums" Watch "Enums" New topic
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
Originally posted by Pradeep Bhat:
Do enums extend java.lang.Object?



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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Enums
 
Similar Threads
Enum in private inner class.
enum static methods
Enum
Expression Language not evaluating generic Java Map and list as desired
Switch Statement