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) {
        // create map
        Map<String, String> map = new HashMap<String, String>();

        // populate the map
        map.put("1", "A");
        map.put("2", "B");
        map.put("3", "java2s.com");

        // create a synchronized map
        Map<String, String> synmap = Collections.synchronizedMap(map);

        System.out.println("Synchronized map is :" + synmap);
    }
}