I have an Employee class with empid, name and age and there are an array of employee objects created and their fields are initialized. Now how do I (a)Sort and scramble the array using Arrays.Sort(). Also, how do I ensure the foll:
# anti-commutation : x.compareTo(y) is the opposite sign of y.compareTo(x) .
# exception symmetry : x.compareTo(y) throws exactly the same exceptions as y.compareTo(x) .
# transitivity : if x.compareTo(y)>0 and y.compareTo(z)>0, then x.compareTo(z)>0 (and same for less than) .
# if x.compareTo(y)==0, then x.compareTo(z) has the same sign as y.compareTo(z) .
# consistency with equals is highly recommended, but not required : x.compareTo(y)==0, if and only if x.equals(y) . Any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note:
this class has a natural ordering that is inconsistent with equals."