90
Java Vector isEmpty() Method
The isEmpty() method of Java Vector class is used to check if this vector has no components. It returns true if the vector is empty, otherwise returns false.
Syntax
Following is the declaration of isEmpty() method:
Parameter
This method does not accept any parameter.
Return
The isEmpty() method returns true if and only if this vector has no components, otherwise returns false.
Exceptions
NA
Compatibility Version
Java 1.2 and above
Example 1
Output:
Vector: [Java, Ruby, Android, Python] Is the Vector empty? = false Vector after clear(): [] Is the Vector empty? = true
Example 2
Output:
Vector: [] Is the Vector empty? = true
Example 3
Output:
Vector isEmpty() before? false Vector isEmpty() after ? true
Next TopicJava Vector