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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Enums" Watch "Enums" New topic
Author

Enums

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

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

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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

The Enum API is always a good place to find answers to questions like this.


GenRocket - A Test Data Generation Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enums
 
Similar Threads
Expression Language not evaluating generic Java Map and list as desired
Enum
enum static methods
Switch Statement
Enum in private inner class.