Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.HashMap;

public class Main {
    public static void main(String args[]) {
        HashMap<Integer, String> newmap = new HashMap<Integer, String>();

        // populate hash map
        newmap.put(1, "tutorials");
        newmap.put(2, "from");
        newmap.put(3, "java2s.com");

        System.out.println("Values before remove: " + newmap);

        // remove value for key 2
        newmap.remove(2);

        System.out.println("Values after remove: " + newmap);
    }
}