Home
Site Map
Useful Tools
Graphing Calc

Scientific Calculator

The Comparable Interface

We are going to implement the Comparable interface (which we will define, in the account and Students classes that we wrote in the past. This class only has static methods that take an Array of Accounts, Students or Schools.

Interface: Comparable

The comparable interface is a publicly available method that has 1 and only 1 method . You do not need to
  int compareTo(E other)
  
Modifying Student
  • Your class declaration header should now be :
public class Student implements Comparable<Student>{ ...



Modifying Account
  • Your class declaration header should now be :
public class Account implements Comparable<Account>{ ...



Modifying School
  • Your class declaration header should now be :
public class School implements Comparable<School>{ ...



Download the runner for Comparable
When you are done, use this runner below to make user of the printable interface.
Sitemap