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
πŸ’¬ Discuss
βœ… Correct Answer: (A) true
Explanation: 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.
Explanation by: Mayank
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.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
347
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mayank
Publisher
πŸ“ˆ
83%
Success Rate