Module5opp Part2
Module5opp Part2
www.cambridge.edu
.in
Enumerations
• an enumeration is a list of named constants.
• Java enumerations appear similar to enumerations in other
languages. However, this similarity may be only skin deep
because, in Java, an enumeration defines a class type.
• By making enumerations into classes, the capabilities of the
enumeration are greatly expanded. For example, in Java, an
enumeration can have constructors, methods, and instance
variables. Therefore, although enumerations were several years
in the making, Java’s rich implementation made them well
worth the wait.
Enumerations…….
• An enumeration is created using the enum keyword
Boolean(boolean boolValue)
Boolean(String boolString)