K

Kirti • 10.45K Points
Tutor II

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
  • Correct Answer - Option(A)
  • Views: 111
  • Filed under category JAVA

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.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics