Delete comment from: Java67
For those, who wants to learn more, Enum in Switch case is implemented using ordinal() method. Since as per Java programming language, we can only pass int into Switch case, ordinal() returns int. So above code of Enum with Switch will actually translate into
switch(today.ordinal()){
case Monday.ordinal():
break;
case Tuesday.ordinal():
break;
}
Oct 24, 2013, 10:12:52 PM
Posted to How to use Java Enum in Switch Case Statement - Exampel Tutorial