Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] argv) throws Exception {
        Map map = new HashMap();

        // Create int wrapper object
        Integer refInt = new Integer(123);

        // Store int in map
        map.put("key", refInt);

        // Get int value from map
        refInt = (Integer) map.get("key");

        // Get the integer value from wrapper object
        int i = refInt.intValue();
    }
}