wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is Enum? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is Enum?" Watch "What is Enum?" New topic
Author

What is Enum?

Arun Kumar Gaddam
Ranch Hand

Joined: May 05, 2007
Posts: 58
hai friends ,iam new java 5
Can any body explain me what is an Enum?
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
Originally posted by Arun Kumar Gaddam:
hai friends ,iam new java 5
Can any body explain me what is an Enum?




public abstract class java.lang.Enum implements java.lang.Comparable, java.io.Serializable {}




Output:
true
class java.lang.Enum


Thanks,


cmbhatt
Faisal Ahmad
Ranch Hand

Joined: Aug 31, 2006
Posts: 346

Originally posted by Arun Kumar Gaddam:
hai friends ,iam new java 5
Can any body explain me what is an Enum?

enum is a Java keyword used in defining enumerated list of constants. It also declares a class of type "enum". You can declare methods and variables too! Its also allowed to implement interfaces. Well, there is lot more that you can do with enum in Java than its counterparts in C++/C/C#!
Check this link for a very good introduction and explanation http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html
Its very short too!
PS: By the way, enumeration means a numbered list!
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You can also read the Enums section of Sun's Java Tutorial


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is Enum?
 
Similar Threads
abstract method within an enum ?
Enum
retrieve enumeration datatype into jsp
How to define constants for several classes?
What is the usage on enum types?