Collections sort(List<T>,Comparator<? super T>) method example
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8036429/sorting-java-objects-using-multiple-keys">Sorting Java objects using multiple keys</a>  </p>
</blockquote>



<p>I can't find any example of using this method, all examples give the second parameter "null".
I heard that this method used for sorting classes according to more than one criterion but no example where found.</p>

<pre><code>public class Student implements Comparable&lt;Student&gt; {
String name;
int age;

public Student(String name, int age) {
    this.name = name;
    this.age = age;
}

@Override
public String toString() {
    return name + ":" + age;
}

@Override
public int compareTo(Student o) {
    Integer myAge = age;
    Integer oAge = o.age;
    return myAge.compareTo(oAge);
}
</code></pre>

<p>}</p>

<p>for this class if i want to sort a list of Student according to their names &amp; ages how can i use the method Collections sort(List,Comparator) </p>
