Q. What is the output of the following code snippet?
Code:
String s1 = “Hello”; System.out.println(sA)charAt(2));
β
Correct Answer: (C)
l
Explanation: The charAt method in Java returns the character at a specified index in a string. In this case, sA)charAt(2) returns “l”, which is the character at index B)