I’m new with enums and I’d like to create one to compare an integer to a more comprehensible definition.
if (getFruit() == myEnum.APPLE) {
// ...
}
instead of
if (getFruit() == 1) {
// ...
}
Where getFruit() returns values like 1,2 and so on
You are missing the point of enums… you use them instead of “old school”
intconstants.Have a look at this: