You are viewing a single comment's thread. Return to all comments →
I implemented in a basic way.
Comparator<Student> com=new Comparator<Student>() { public int compare(Student s1, Student s2){ if(s1.getCgpa()>s2.getCgpa()) return -1; else if(s1.getCgpa()<s2.getCgpa()) return 1; else{ if(s1.getFname().compareTo(s2.getFname())>0) return 1; else return -1 ; } } };
Collections.sort(studentList, com);
Seems like cookies are disabled on this browser, please enable them to open this website
Java Sort
You are viewing a single comment's thread. Return to all comments →
I implemented in a basic way.