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 What is Enum? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is Enum?" Watch "What is Enum?" New topic
Author

What is Enum?

Mrutyunjaya Sahu
Greenhorn

Joined: Oct 02, 2011
Posts: 1
Hey all,

I'm beginner to Java, could anybody explain about Enum with an example please?

Thanks in advance....

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3649
    
  17

Hello, welcome to CodeRanch!

Enums are lists of constants. When you need a predefined list of values which do not represent some kind of numeric or textual data, you should use an enum. For instance, in a chess game you could represent the different types of pieces as an enum:
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Also see the oracle tutorial about enums.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is Enum?