Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        List<String> aList = new ArrayList<String>();
        Map<Integer, String> aMap = new HashMap<Integer, String>();
        aList.add("A");
        aList.add("B");

        for (int i = 0; i < aList.size(); i++) {
            aMap.put(i + 1, aList.get(i));
        }

        System.out.println(aMap.toString());
    }
}