Explain Enumerated type

Enumerated type: A data type-not directly accessible in Java - in which symbolic names are employed for a series of constant numeric values. They facilitate the evading of magic numbers. They can be simulated in the Java with fields in an interface, for example:

    public interface States {
        public static final int Stop = 0, Go = 1;
    }

Though, the compiler type checking generally available with the enumerated kinds is not accessible with this form.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.