Enum: name() : Enum « java.lang « Java by API






Enum: name()

enum ProgramFlags {
    showErrors(0x01),
    includeFileOutput(0x02),
    useAlternateProcessor(0x04);

    private int bit;

    ProgramFlags(int bitNumber)
    {
        bit = bitNumber;
    }

    public int getBitNumber()
    {
        return(bit);
    }

}

public class EnumBitmapExample {
    public static void main(String args[])
    {
        ProgramFlags flag = ProgramFlags.showErrors;

        System.out.println("Flag selected is: " +
                                flag.ordinal() +
                           " which is " +
                                flag.name());
    }
}

           
       








Related examples in the same category

1.Enum: compareTo(Object o)
2.Enum: equals(Object other)
3.Enum: ordinal()
4.Enum: valueOf(String v)
5.Enum: values()