We help IT Professionals succeed at work.

Changing Enum objects

itnifl
itnifl asked
on
Take a look at the code below. Lets say I have made an object with the value "Card." How would I  about changing the value in the same object?
enum AccessMethod {
	Card, Code, Both;
}

//In some other class:
private AccessMethod aMethod = AccessMethod.valueOf(method);
//Where methid is a string containing one of the three values

Open in new window

Comment
Watch Question

You can simply replace the value in the variable:
aMethod = AccessMethod.Card
or
aMethod = AccessMethod.valueOf(newStrValue);
itniflProgrammer

Author

Commented:
Offcourse. Thanks.