MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class MainClass {
    public static void main(String args[]) throws Exception {
        List list = Arrays.asList("a", "c", "b");
        Collections.sort(list);
        for (int i = 0, n = list.size(); i < n; i++) {
            if (i != 0)
                System.out.print(", ");
            System.out.print(list.get(i));
        }
        System.out.println();
    }
}