JAVA array sorting method, Arrays.sort () method question?

this API specifies that the entity bean implements the comparable interface and overrides the compareTo method. Why not change API to Arrays.sort (Compatable [] com)?

Mar.28,2021

The real reason for

is that it has to be designed this way because of a feature of the Java array. Simply put, the runtime type of the Java array is not determined by its element type, but by the type when it is actually instantiated.

for example, the following array:


Compatable[]sort

int [] a ={1,2,3,6,4,3,23,5,6,7,9};

Arrays.sort(a);

//a = [1, 2, 3, 3, 4, 5, 6, 6, 7, 9, 23]
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea9b23-1f79.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea9b23-1f79.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?