Q. What is the output of the following code snippet?

Code:
String s1 = “Hello”;
System.out.println(sA)toUpperCase());
  • (A) HELLO
  • (B) hello
  • (C) Hello
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) HELLO
Explanation: The toUpperCase method in Java returns a new string that is the original string with all lowercase letters converted to uppercase. In this case, sA)toUpperCase() returns “HELLO”.
Explanation by: Kirti
The toUpperCase method in Java returns a new string that is the original string with all lowercase letters converted to uppercase. In this case, sA)toUpperCase() returns “HELLO”.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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