07 Enumerations and Nested Classes Flashcards
It is a data type that contains a fixed set of constants.
Enumeration
Keyword that is used to create an enumeration.
enum
The list of values of enum are called?
enum constants
What are the non-static built-in methods of the enum constants?
toString()
ordinal()
equals(
compareTo()
Method that returns an integer that represents the constant’s position in the list of constants; the first position is 0.
ordinal()
Method that returns true if its argument is equal to the calling object’s value.
equals(
Method that returns a negative integer if the calling object’s ordinal value is less that that of the argument, 0 if they are the same, and otherwise positive.
compareTo()
Method that return the name of the calling constant object.
toString()
What are the two (2) useful static methods used with enumerations?
valueOf()
values()
Method that accepts a string parameter and returns an enumeration constant.
valueOf()
Method tat returns an array of the enumerated constants.
values()
It is used to describe a data type for that allows only appropriate behaviors.
type-safe
A class within another class is called?
Nested classes
What are the four (4) types of nested classes?
Static member class
Non-static member class (inner class)
Local class
Anonymous class
Type of class that has access to all static methods of the top-level class.
Static member class
Type of class that requires an instance; it has access to all data and methods of the top-level class.
Non-static member class (inner class)
Type of class that is define within a method body.
Local class
Type of class that is a special case of a local class that has not identifier
Anonymous class