Can you provide some help to solve this problem

plz share the right approach to solve it.

@Yuganshu,

this problem is very simple using interface
just implement the comparable interface and write the compareTo method to sort according to given condition
https://ide.codingblocks.com/s/234889 you can take help of this code and understand the approach.

You need to create a separate class for Salary inputs and define a constructor to take input and compare function to remove redundant values.

Hi Sanchit,
Created 2 classes Sortbyname and Sortbsalary implementing comparator . i am able to sort separately on the basis of salary or name using Collections but cannot implement the required logic. plz change the code in link for help.

@Yuganshu,
https://ide.codingblocks.com/s/237924 corrected code.

@Yuganshu,
I have also added comments for your reference.

sanchit why do we use @Override in checker class.

@Yuganshu,

The @ Override indicates that the child class method is over-writing its base class method.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.