πŸ“Š JAVA
Q. What is the output of the following code snippet?
Code:
String s1 = “Hello”;
String s2 = “hello”;
System.out.println(sA)equals(s2));
  • (A) True
  • (B) False
  • (C) Error
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) False

Explanation: The equals method in Java checks whether two strings are equal in content. In this case, s1 and s2 have different cases, so sA)equals(s2) returns false.

Explanation by: Kirti
The equals method in Java checks whether two strings are equal in content. In this case, s1 and s2 have different cases, so sA)equals(s2) returns false.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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