title: Comparing two instances of a class in Java
body: <p>I have a class with two integer members. These members are block and offset numbers. I need to compare two instances of this class with great or less signs. For example; </p>
  
  <pre><code>instance1 &lt; instance2
  </code></pre>
  
  <p>statement needs to return true if </p>
  
  <pre><code>instance1.blockNumber &lt; instance2.blockNumber;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>instance1.blockNumber = instance2.blockNumber;
  instance1.offset &lt; instance2.offset;
  </code></pre>
  
  <p>As far as I know Java doesn't support operator overloading. How can I do this such comparison?</p>