A

Admin • 825.56K Points
Coach

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

Code:
String s1 = “Hello”;
String s2 = “hello”;
System.out.println(sA)equalsIgnoreCase(s2));
  • (A) true
  • (B) false
  • (C) Error
  • (D) None of the above
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
The equalsIgnoreCase method in Java checks if two strings have the same value ignoring case. In this case, s1 has the value “Hello” and s2 has the value “hello”, but because the case is ignored, sA)equalsIgnoreCase(s2) returns true.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.