In the below example I have used ArraySorting method to sorting array object. Here I have initialized Object array and then I have used Array sorting method and
java.util.Arrays.sort(Object[]) method to sort object ArrayList. You can see below program it will clearly describe to use Array object sorting method in java .
import java.util.Arrays;
public class Array9 {
public static void main(String[] args) {
// initializing Object array
Object ob[] = {24, 110, 04};
// sorting array
Arrays.sort(ob);
// let us print all the elements available in list
System.out.println("The sorted Object array is:");
for (Object number : ob) {
System.out.println("Number = " + number);
}
}
}
Output- The sorted Object array is:
Number = 4
Number = 24
Number = 110
0 Comment(s)