Things you should know for the Fall 2007 CS211 Midterm #2

You really should know everything from Midterm #1 as well, but we will focus on things taught after midterm one.

Review Problems and Answers

Problems:

Other Questions:

Inheritance
- How do I make a method that no one can override?
- If you create an abstract method in a class, does the class itself need to be abstract?
- If you create an abstract method in a class and another class extends that class, what must the child class do?

Polymorphism
- Write a class Clock that has a method getTime();
- Write a subclass of Clock, AnalogClock that returns the Hours/Mins when getTime is called
- Write a sublcass of Clock, AtomicCLock that returns the Hours/Mins/Seconds/Milliseconds when getTime is called
- Write a test method that uses a Clock variable (Clock c;) and assigns it to either an Analog or Atomic clock and calls getTime.
- This is using polymorphism to determine which method gets called