Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Enumeration;
import java.util.Hashtable;

public class Main {
    public static void main(String[] s) {
        Hashtable<String, String> table = new Hashtable<String, String>();
        table.put("key1", "value1");
        table.put("key2", "value2");
        table.put("key3", "value3");

        Enumeration e = table.elements();
        while (e.hasMoreElements()) {
            String key = (String) e.nextElement();
            System.out.println(key + " : " + table.get(key));
        }

        System.out.println(table.values());
    }
}