A special type of data type which is a collection of constants is known as an Enum.
public enum Days{
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
}
Here, Days is a variable of enum type and is a collection of 7 constants.
enumMap is the map implementation which is sued with enum type and enumSet is the set implementation which is sued with enum type.
The different design patterns which can be implemented using enums are as follows:
Singleton Pattern
Strategy Pattern
Knowledge2life1
Knowledge2life2
Knowledge2life
|