Lecture 8 Objectives
At the end of today's class you should
KNOW:
- that in Java, interfaces may extend other interfaces
- that you should use an interface if you want the flexibility of
using different implementations of the same datatype
- that a cast is a way to tell Java you're confident of the type of
an object
- that a cast can remove compilation errors, but if used incorrectly, it may
introduce runtime errors
BE ABLE TO:
- use an interface in Java as a means to provide multiple implementations of a type
- create instances of a data structure (like a set) where each instance
uses a different underlying implementation
- know when and how to use a cast
Sample Exam Question:
Sketch out the UML diagram for an AVL tree implementation of an ISet (you don't have
to write code at this point, just draw the UML).
Then, rewrite the Examples class from today's code so that the PartyGuests object
PG
uses your AVL implementation of ISet.