http://javarevisited.blogspot.com/2011/08/enum-in-java-example-tutorial.html
http://javarevisited.blogspot.com/2011/12/convert-enum-string-java-example.html
An enum example
http://javarevisited.blogspot.com/2011/12/convert-enum-string-java-example.html
An enum example
private enum Score { MINUS10(-10), MINUS5(-5), ZERO(0), PLUS5(5), PLUS10(10); private final int value; private Score(int value) { this.value = value; } public int getValue() { return value; } static public boolean isValid(int value) { Score[] scores = Score.values(); for (Score aScore : scores) { if (aScore.getValue() == value) { return true; } } return false; } }
Comments
Post a Comment