public static void main(String[] args) {
// TODO Auto-generated method stub
String[] suits = {"hearts","Diamonds","Clubs","Spades"};
List<String> list = Arrays.asList(suits);
System.out.printf("Unsorted array element : %s%n",list);
Collections.sort(list,Collections.reverseOrder());
System.out.printf("Sorted lest element : %s%n",list);
}
}
Top comments (1)
Which part?
Public means that this can be called from anywhere
Static means that it cannot be inherited from or a copy created using the new keyword
Void means it will not return a value
Main indicates that this is the entry point to the class or module
String[] suits is creating a new variable (suits) with a type of array of strings. The right hand side is assigning the value
List list is creating another variable and uses the array prototype to convert the array to a list
Someone else finish the rest....