String a = "cat";
String b = "dog";
if (a.equals(b)) {
System.out.println("same");
} else {
System.out.println("different");
}What is printed?
- A
same
- Bcheck_circle
different
- C
compile error
- D
true
Explanation
"cat".equals("dog") is false because the strings have different content, so the else branch prints "different".