Professional Documents
Culture Documents
3.Algorithm:
For Java hashtable
1. Import enumeration and hashtable libraries.
2. Create object of hashtable and use put function to insert the element in the table.
3. Create object of enumeration and use while loop to iterate the elements.
4.Code:
import java.util.Enumeration;
import java.util.Hashtable;
public class Main {
public static void main(String[] args)
{
Hashtable ht = new Hashtable();
ht.put("1", "One");
ht.put("2", "Two");
ht.put("3", "Three");
Enumeration e = ht.keys();
while (e.hasMoreElements())
{
System.out.println(e.nextElement());
}
}
5.Output:
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the
faculty):