[Solved] the enum typle cannot be passed into function like the object reference in java? [closed]


Object a = new Object(); 
method(a);
public void method(Object a){
        // do operation on Object a 
}

Since you are passing the object reference the change will get reflect on your actual object.

An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must be equal to one of the values that have been predefined for it. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week.

Because they are constants, the names of an enum type's fields are in uppercase letters.

Enums are constants are meant to keep its state. just like public static final constants.

solved the enum typle cannot be passed into function like the object reference in java? [closed]