You need to write the class you marked and rewrite the compareTo() method in it. What is implemented in the method is the comparison method you need. For example, if you want to compare based on students' names, you can just write the comparison method of the names in it. You can see how its default comparison method is implemented and you will understand. There is no change in the creation of collection objects.
You need to write the class you marked and rewrite the compareTo() method in it. What is implemented in the method is the comparison method you need. For example, if you want to compare based on students' names, you can just write the comparison method of the names in it. You can see how its default comparison method is implemented and you will understand. There is no change in the creation of collection objects.