Home » Java Vector elements() Method with Examples

Java Vector elements() Method with Examples

by Online Tutorials Library

Java Vector elements() Method

The elements() method of Java Vector class used to get an enumeration of the elements of the vector which is in use. The returned enumeration object will generate all items in this vector at the same location.

Syntax:

Following is the declaration of elements() method:

Parameter:

This method does not accept any parameter.

Returns:

The elements() method returns an enumeration of the elements of this vector.

Exceptions:

NA

Compatibility Version:

Java 1.2 and above

Example 1:

Test it Now

Output:

Data in enumeration object is:   Element: 11  Element: 22  Element: 33  

Example 2:

Test it Now

Output:

Data in enumeration object is:   White  Green  Black  Pink  

Next TopicJava Vector

You may also like