title: comparing two objects with same parent abstract class and the output is zero
body: <p>i have an abstract class that implements comparable  and has the following :</p>
  
  <pre><code>public abstract class Figure  implements Comparable{
  
      protected double height ;
  
      public abstract double getArea();   
  
      public abstract double calculatevolume();//will be used later to compare the volume
  
      public int compareTo(Figure o) {
          return 0;
  
      }   
  }
  </code></pre>
  
  <p>i have  circle and square as  children of  Figure but when i try to compare to volume of two objects it always return 0 !</p>
  
  <p>this is my compareTo  method in the circle class:</p>
  
  <pre><code>public int compareTo(Object o) {
  
      Figure a = (Figure) o;
  
      if (this.calculatevolume() &gt; ((Figure) o).calculatevolume())
          return (int)this.calculatevolume();
      else if (this.calculatevolume() &lt; ((Figure) o).calculatevolume())
          return (int) a.calculatevolume();
  
      else
  
      return 0;
  }
  </code></pre>