Ensuring order in java for objects
<p>I have a class that looks like this </p>

<pre><code>class Student {
   public String str;   
   public int    marks;
}
</code></pre>

<p>Say 3 objects for</p>

<p>Student S1 (str: sub1, marks:10) , S2 (str: sub2, marks:5) , S3 (str:s3, marks:2)</p>

<p>I want to ensure that for Student objects that this condition holds true if sub1 > sub2 > sub3 then marks1 > marks2 > marks3</p>
