Java Vector isEmpty() Method24 Mar 2025 | 2 min read 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. SyntaxFollowing is the declaration of isEmpty() method: ParameterThis method does not accept any parameter. ReturnThe isEmpty() method returns true if and only if this vector has no components, otherwise returns false. ExceptionsNA Compatibility VersionJava 1.2 and above Example 1Output: Vector: [Java, Ruby, Android, Python] Is the Vector empty? = false Vector after clear(): [] Is the Vector empty? = true Example 2Output: Vector: [] Is the Vector empty? = true Example 3Output: Vector isEmpty() before? false Vector isEmpty() after ? true Next TopicJava Vector |
We request you to subscribe our newsletter for upcoming updates.

We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India