Java String isEmpty()

The syntax of the string isEmpty() method is:

string.isEmpty()

Here, string is an object of the String class.


isEmpty() Parameters

The isEmpty() method does not take any parameters.


isEmpty() Return Value

  • returns true if the string is empty (length is 0)
  • returns false if the string is not empty

Example: Java String isEmpty()

Note: A non-initialized string is not an empty string. If you use isEmpty() on a string that is not initialized, you will get an error.