Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        // create set
        SortedSet<String> set = new TreeSet<String>();

        // populate the set
        set.add("from");
        set.add("java2s.com");
        set.add("tutorial");
        set.add("java");

        // create a synchronized sorted set
        SortedSet<String> sorset = Collections.synchronizedSortedSet(set);

        System.out.println("Sorted set is :" + sorset);
    }
}