previous | start | next

CompareTo for BankAccount

public class BankAccount
{
   . . . 
   public int compareTo(Object otherObject)
   {
      BankAccount other = (BankAccount)otherObject;
      if (balance < other.balance) return -1;
      if (balance == other.balance return 0;
      return 1;
   }
   . . . 
}



previous | start | next