21 lines
647 B
Java
21 lines
647 B
Java
import java.util.*;
|
|
|
|
public class SortingArrayList12{
|
|
public static void main(String[] args){
|
|
ArrayList<String> playerList = new ArrayList<String>();
|
|
playerList.add("Sachin Tendulkar");
|
|
playerList.add("Rahul Dravid");
|
|
playerList.add("Virender Sehwag");
|
|
playerList.add("MS Dhoni");
|
|
playerList.add("Virat Kohli");
|
|
playerList.add("Anil Kumble");
|
|
playerList.add("Yuvraj Singh");
|
|
playerList.add("Kapil Dev");
|
|
playerList.add("Sunil Gavaskar");
|
|
playerList.add("Javagal Srinath");
|
|
|
|
System.out.println("Unsorted List: \n" + playerList);
|
|
Collections.sort(playerList);
|
|
System.out.println("\nSorted List: \n" + playerList);
|
|
}
|
|
} |