Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is Enum?

 
Arun Kumar Gaddam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai friends ,iam new java 5
Can any body explain me what is an Enum?
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also read the Enums section of Sun's Java Tutorial
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic