Home » Java Collections enumeration() Method with Examples

Java Collections enumeration() Method with Examples

by Online Tutorials Library

Java Collections enumeration() Method

The enumeration() is a method of Java Collections class which is used to get the enumeration over the specified collection.

Syntax

Following is the declaration of enumeration() method:

Parameter

Parameter Description Required/Optional
c It is a collections for which enumeration is to be returned. Required

Returns

The enumeration() method returns the enumeration over the specified collection.

Exceptions

NA

Compatibility Version

Java 1.5 and above

Example 1

Test it Now

Output:

The Enumeration List are:   JAVA  JSP  SERVLET  C  PHP  PERL  

Example 2

Test it Now

Output:

The Enumeration List are:   1100  2100  5100  

Example 3

Test it Now

Output:

Elements using Enumeration: 101 Hello World true 101.5   

You may also like