Answers for "What are enumerators in java"

0

enumeration java

public enum Feu {

    VERT(0), ORANGE(1), ROUGE(2);


    private int value;

    private Feu( int value ) {
        this.value = value;
    }

    public int toInt() {
        return value;   
    }
    
    public static Feu fromInt( int value ) {
        switch( value ) {
            case 0: return VERT;
            case 1: return ORANGE;
            default: return ROUGE;
        }
    }
    
}
Posted by: Guest on August-15-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language