What is an enumeration?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is an enumeration?

Rating:

An enumeration is a feature added to J2SE 5. It is very similar to a class, except that it cannot be instantiated. It is declared using the keyword enum. An enumeration can have constructors, methods, and instance variables in the same way as a class. Identifiers of an enum are referred to as enum constants. These constants cannot have any type other than the enum-type itself. An enum constructor can never be invoked directly. They are always called automatically on initialization. An enum can be declared inside, as well as outside a class. When declared outside a class, it should be declared either public or default. It cannot be private, protected, static, abstract, or final. A semicolon in the enum declaration is optional and may be put at the end of enum declaration.

An enum is declared as follows:

enum-type{constant1, constant2, constant3}


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.