NameSort.java Source code

Java tutorial

Introduction

Here is the source code for NameSort.java

Source

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

public class NameSort {
    public static void main(String args[]) {
        String n[] = new String[] { "John", "Lennon", "Karl", "Marx", "Groucho", "Marx", "Oscar", "Grouch" };

        List l = Arrays.asList(n);
        Collections.sort(l);
        System.out.println(l);
    }
}