Types, Classes, Interfaces
Classes and Interfaces
When is it useful?
Binary Search Example |
|
Notes: Comparable example is
- Simple: Only specifies one method (
compareTo
)
- Complicated: We don't want to compare against just any other
comparable (e.g., don't want to compare Strings and Students).
Instead we only want to compare objects of a concrete class that
implements Comparable against other objects of the same concrete
class, and that leads to some complicated syntax.
Alyce Brady, Kalamazoo College