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  
smv939Asked:
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() ) ;
  }
}) ;
0
 
smv939Author Commented:
No it did not work. The lastname  is an array of strings.
0
 
ksivananthCommented:
>>The lastname  is an array of strings.

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

From novice to tech pro — start learning today.