Javatpoint Logo
Javatpoint Logo

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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA