A

Admin • 828.70K Points
Coach

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
  • Correct Answer - Option(A)
  • Views: 25
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
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”.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.