Shahid Pathan wrote:Thanks... I understood
This will work surely if you want to sort by ageor salary or designation make three comparators as shown below
/*Take a person class
Attributes: name, age, salary
A
1. Add few sample person objects to an array list
2. Sort arraylist based on person’s age in descending order
B
1. Sort arraylist based on person’s salary in ascending order
*/