Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

        HashMap<String, String> hmap = new HashMap<String, String>();

        hmap.put("1", "A");
        hmap.put("2", "B");
        hmap.put("3", "C");
        hmap.put("4", "from java2s.com");

        // get typesafe view of the map
        Map<String, String> tsmap = Collections.checkedMap(hmap, String.class, String.class);

        System.out.println(tsmap);
    }
}