I have the following class.
class{
String name;
int marks;
};
Now i have to sort the objects either alphabetically(names) or descending(marks),based on user input. How to write the comparator function for this. User will enter 'n' to sort using names and 'm' to sort using marks.