1:28 pm - Saturday March 25, 2017

Hashtable Example program for elements()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
Author :candidjava.com
Description: Returns an enumeration of the values in this hashtable.
*/
import java.util.*;
import java.util.Hashtable;
import java.io.IOException;
public class HashtableElementsExample
{
public static void main(String args[])throws IOException
{
int s=33, s1=44,s2=55;
Enumeration e;
Hashtable h=new Hashtable();
h.put(1,s);
h.put(2,s1);
h.put(3,s2);
e=h.elements();    //returns the enumeration of values
while (e.hasMoreElements())
System.out.println(e.nextElement());
System.out.println(e);
}
}

Output:

55
44
33

Filed in: Core Java Tutorial

Comments are closed.