Q. What is the output of the following code snippet?
Code:
String s1 = “Hello”; System.out.println(sA)startsWith(“He”));
β
Correct Answer: (A)
True
Explanation: The startsWith method in Java checks whether a string starts with a specified substring. In this case, sA)startsWith(“He”) returns true because the string “Hello” starts with “He”.