• + 0 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);