MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

/**
 *Output:
A: 3434.34
 */

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

public class MainClass {
    public static void main(String args[]) {
        Hashtable<String, Double> balance = new Hashtable<String, Double>();

        Enumeration<String> names;
        String str;

        balance.put("A", 3434.34);

        names = balance.keys();
        while (names.hasMoreElements()) {
            str = names.nextElement();
            System.out.println(str + ": " + balance.get(str));
        }

        System.out.println();
    }
}