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();
}
}
|