πŸ“Š JAVA
Q. What is the output of the following code snippet?
Code:
String s1 = “Hello”;
int i = 2;
System.out.println(sA)charAt(i));
  • (A) l
  • (B) e
  • (C) Error
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) 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’.

Explanation by: Kirti
The charAt method in Java returns the character at a specified index in a string. In this case, sA)charAt(2) returns ‘l’.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
308
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Kirti
Publisher
πŸ“ˆ
85%
Success Rate