Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static void main(String[] a) {
        Map<String, String> yourMap = new HashMap<String, String>();
        yourMap.put("1", "one");
        yourMap.put("2", "two");
        yourMap.put("3", "three");

        Map<String, String> sortedMap = new TreeMap<String, String>(yourMap);

        System.out.println(sortedMap);
    }
}
//{1=one, 2=two, 3=three}