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

Code:
String s1 = “Hello”;
System.out.println(sA)isEmpty());
  • (A) True
  • (B) False
  • (C) Error
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) True
Explanation: The isEmpty method in Java checks whether a string is empty, i.e. has a length of zero. In this case, s1 is not empty, so sA)isEmpty() returns false.
Explanation by: Kirti
The isEmpty method in Java checks whether a string is empty, i.e. has a length of zero. In this case, s1 is not empty, so sA)isEmpty() returns false.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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