Sort a string array in Java

Hi all,
I have an Array of Sales data from the table. SalesID, SFirstname, SlastName.
  I want to display this data in the order of Slastname. SData s[]  is the array.
 Please help.

Shaji Mary  
Who is Participating?
ksivananthConnect With a Mentor Commented:
try this,

Arrays.sort( salesArray, new Comparator<Sales>(){
  public int compare( Sales o1, Sales o2 ){
    return o1.getlastname().compareTo( o2.getLastName() ) ;
}) ;
smv939Author Commented:
No it did not work. The lastname  is an array of strings.
>>The lastname  is an array of strings.

How can that be? can you post the code of the Sales class?
All Courses

From novice to tech pro — start learning today.