Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java List Sort Using sort() method

import java.util.*;
 
public class Main {  
public static void main(String[] args) {  
        List<String> list= new ArrayList<>(); 
        
        list.add("Apple");  
        list.add("Mango");  
        list.add("Banana");  
     
        System.out.println("List : "+list);  
        //will sort the string acc to the alphabets  
        Collections.sort(list);  
        System.out.println("Sorted List : "+list);  
    }  
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Java #List #Sort #Using #method
ADD COMMENT
Topic
Name
6+1 =