Sort an Array Using Java

 JAVA SORT


In java to sort an array you can simply put Arrays.sort(arrayName); in the case of Arrays and to sort Collections(ArrayList,LinkedList...) we use Collections.sort(listName);.

But you can also sort by using for loop.


1. Java Sorting using for loop

Java sort array
Sort using for loop


2. Java Sort Using Arrays.sort()

Arrays.sort() method
Sort an array using Arrays.sort() 






Comments