Compare two characters
int compareTo(Character anotherCharacter)
- Compares two Character objects numerically.
boolean equals(Object obj)
- Compares this object against the specified object.
public class Main {
public static void main(String[] argv) {
Character character1 = new Character('a');
Character character2 = new Character('b');
System.out.println(character1.compareTo(character2));
}
}
The output:
-1