1public class JavaCharacterCompareExample1 {
2 public static void main(String[] args) {
3 char firstValue = 'A';
4 char secondValue = 'B';
5 // compare the first char to the second
6 int result = Character.compare(firstValue, secondValue);
7 if (result == 0) {
8 System.out.println("The chars are the same.");
9 } else {
10 System.out.println("The chars are different.");
11 }
12 }
13}