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