MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.HashMap;
import java.util.Map;

public class MainClass {
    public static void main(String args[]) {

        String[] names = { "A", "J", "B", "E", "P" };
        String[] ids = { "1", "2", "9", "8", "7" };

        Map<String, String> IDMap = new HashMap<String, String>();

        for (int i = 0; i < names.length; i++)
            IDMap.put(ids[i], names[i]);

        System.out.println(IDMap.size() + " Students entered: ");
        System.out.println(IDMap);

    }
}