class Program01 { public static void main(String args[]) { char ch1 = 'a'; char ch2 = 'a'; char ch3 = 'c'; System.out.println(Character.compare(ch1, ch2)); // 0 System.out.println(Character.compare(ch1, ch3)); // -2 System.out.println(Character.compare(ch3, ch1)); // 2 } }