Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;
import java.util.TreeSet;

public class Main {
    public static void main(String args[]) throws Exception {

        String elements[] = { "java2s.com", "C", "D", "G", "F" };
        TreeSet<String> set = new TreeSet<String>(Arrays.asList(elements));
        TreeSet<String> set1 = new TreeSet<String>(set);
        System.out.println(set1);
    }
}