xxxxxxxxxx
char char1 = 'a';
char char2 = 'b';
// Comparing characters using relational operators
boolean equal = (char1 == char2);
boolean greaterThan = (char1 > char2);
boolean lessThan = (char1 < char2);
// Comparing characters using compareTo method
int comparisonResult = Character.compare(char1, char2);
xxxxxxxxxx
char char1 = 'a';
char char2 = 'b';
if (char1 == char2) {
System.out.println("Characters are equal");
} else {
System.out.println("Characters are not equal");
}
xxxxxxxxxx
If your input is a character and the characters you are checking against are mostly consecutive you could try this:
if ((symbol >= 'A' && symbol <= 'Z') || symbol == '?') {
// ...
}