I have an enum named PawnColor which simply contains the following:
public enum PawnColor {
black, white, none, illegal
}
If I had the following method, how could I check the color of the current instance of PawnColor?
public double ratePosition (PawnColor ratingFor) {
// ...
}
So if ratingFor
had the color: illegal
, how could I go about checking this? I've never worked with enums before, I feebly tried doing:
if(ratingFor.equals(illegal)) {
System.out.println("Something has gone wrong.");
}
It didn't work obviously, how would I make sure that I get an error message when PawnColor ratingFor is illegal?