This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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

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.
 
GeeCON Prague 2014
 
subject: What is Enum?