Q. What is the output of the following code snippet?
Code:String s1 = “Hello”; String s2 = “hello”; System.out.println(sA)equalsIgnoreCase(s2));
β
Correct Answer: (A)
true
Explanation: The equalsIgnoreCase method in Java checks if two strings have the same value ignoring case. In this case, s1 has the value “Hello” and s2 has the value “hello”, but because the case is ignored, sA)equalsIgnoreCase(s2) returns true.