How to sort Arraylist consisting of pojo class in java <p>I have POJO class Student like this</p> <pre><code>class Student { private int score; private String FirstName; //Getters and setters ................. } </code></pre> <p>I am creating ArrayList like this</p> <pre><code>public static void main(String[] args) { List&lt;Student&gt; al_students= new ArrayList&lt;Student&gt;(); Student s1= new Student(); s1.setScore(90); s1.setFirstName("abc"); al_students.add(s1); Student s2= new Student(); s2.setScore(95); s2.setFirstName("def"); al_students.add(s2); Student s3= new Student(); s3.setScore(85); s3.setFirstName("xyz"); al_students.add(s3); } </code></pre> <p>Now I want to sort it based on scores in descending order i.e<br> output</p> <pre><code>1)def 95 2)abc 90 3)xyz 85 </code></pre>