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 these
πŸ’¬ Discuss
βœ… Correct Answer: (A) True
Explanation: The equalsIgnoreCase method in Java checks whether two strings are equal in content, ignoring differences in case. In this case, s1 and s2 have different cases, but sA)equalsIgnoreCase(s2) returns true because the comparison is case-insensitive.
Explanation by: Kirti
The equalsIgnoreCase method in Java checks whether two strings are equal in content, ignoring differences in case. In this case, s1 and s2 have different cases, but sA)equalsIgnoreCase(s2) returns true because the comparison is case-insensitive.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
311
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Kirti
Publisher
πŸ“ˆ
99%
Success Rate