Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind Java String isEmpty() Method?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___ myStr1 = "Hello";3Order
Put the learning moves in the order that makes the concept easiest to apply.
The isEmpty() method checks whether a string is empty or not.
Definition and Usage
Java String isEmpty() Method
❮ String Methods
Example
String myStr1 = "Hello";
String myStr2 = "";
System.out.println(myStr1.isEmpty());
System.out.println(myStr2.isEmpty());Definition and Usage
The isEmpty() method checks whether a string is empty or not.
This method returns true if the string is empty ( length() is 0), and false if not.
Syntax
public boolean isEmpty()Parameters
None.
Technical Details
| Returns: | A boolean value: true - The string is empty (length() is 0) false - The string is not empty |
|---|
- true - The string is empty (length() is 0)
- false - The string is not empty