ComparableTester.java.html

  1  import java.util.Arrays;
  2  
  3  public class ComparableTester
  4  {
  5     public static void main(String[] args)
  6     {
  7        BankAccount[] accounts = new BankAccount[3];
  8        accounts[0] = new BankAccount(10000);
  9        accounts[1] = new BankAccount(0);
 10        accounts[2] = new BankAccount(2000);      
 11        Arrays.sort(accounts);
 12        for (int i = 0; i < accounts.length; i++)
 13        {
 14  	 System.out.print(accounts[i].getBalance() + " ");
 15        }
 16        System.out.println();
 17        System.out.println("Expected: 0.0 2000.0 10000.0");
 18     }
 19  }