0
Sorting
If the list of students and their mark is taken as input than can anyone tell to srt them and fing the students with above then 80% marks
1 ответ
+ 5
I'm assuming students is a class and mark is an attribute of class student and you are saving each instance of student to a data structure like an ArrayList.
If mark is the ONLY attribute that you will use for sorting, then implement the Comparable interface and then override the compareTo method.
In case you want to have more than one way of sorting your class objects, then you should use comparators.