11.1 | Constructors
Constructor declarations are similar to method declarations. However, the constructors’ names must be the same as the class name and it cannot return a value. The main objective of a constructor is to set the initial state of an object. When the object is created by using the new operator. The following code shows how to declare constructors with and without input parameters.
11.2 | ENUM
Enum is a Java keyword used to represent a fixed number of well-known values. For example, the number of days in a week, the number of planets in the solar system, etc.
Example 11.2.1 Simple enum of weekdays.
Example 11.2.2 Simple enum of weekdays with weekday number
Example 11.2.3 An enum defining weekday full name and weekday number