3. Months expressed as Enumeration Values.

Listing 3. Months expressed as Enumeration Values.


public final class Month ...
{
    public static final Month january = new Month(1);
    ...
    public static final Month december = new Month(12);
    public int getValue() { return value; }
    ...
    private Month(int month) { value = month; }
    private final int value;
}

About the Author

Kevlin Henney is a Principal Technologist with QA Training in the UK.

Upcoming Training Events

0 AM
Visual Studio Live! San Diego
September 8-12, 2025
Live! 360 Orlando
November 16-21, 2025
Cloud & Containers Live! Orlando
November 16-21, 2025
Data Platform Live! Orlando
November 16-21, 2025
Visual Studio Live! Orlando
November 16-21, 2025