the enum typle cannot be passed into function like the object reference in java? -
object = new object(); method(object a);
if change value of in method, value of outside of method should changed.
enum b = enum.something; method(enum b);
if change value of b in method, value of b outside of method, found didn't change. don't know why?
object = new object(); method(a); public void method(object a){ // operation on object }
since passing object reference change reflect on actual object.
an enum type special data type enables variable set of predefined constants. variable must equal 1 of values have been predefined it. common examples include compass directions (values of north, south, east, , west) , days of week. because constants, names of enum type's fields in uppercase letters.
enums constants meant keep state. public static final
constants.
Comments
Post a Comment