String a = "dog";
String b = "cat";
System.out.println(a.compareTo(b) > 0);What is printed?
- Acheck_circle
true
- B
false
- C
0
- D
1
Explanation
"dog" comes after "cat" lexicographically, so a.compareTo(b) returns a positive integer, which is greater than 0.