[Solved] How can i sort objects in arrayList? [closed]
Use Comparable and Comparator as shown below, you can also visit https://www.journaldev.com/780/comparable-and-comparator-in-java-example for further details. import java.util.Comparator; class Employee implements Comparable<Employee> { private int id; private String name; private int age; private long salary; public int getId() { return id; } public String getName() { return name; } public int getAge() { return age; } … Read more