Topics list for Second Semester Midterm 1
- Interfaces and Polymorphism
- When to use interfaces or classes
- Mobile problem illustrated use of Structure as interface--it's just about methods, not fields
- Animal was a class because it stored weight and name
- super(parameter_list) calls superclass constructor
- super.method(parameter_list) calls a method in the superclass
- Superclass default constructor is created by Java if one is not explicitly written by the programmer
- Object is the superclass of any class that does not explicitly extend another class
- Comparable<T>
- Cow array example (class Cow implements Comparable<Cow>)
- Animal array example (lots of different animals extending Animal in array, class Animal implements Comparable<Animal>)
- Inheritance and Delegation
- GridWorld examples
- TriangleBug extends Bug extends Actor (implicitly extends Object)
- TriangleBug inherits the properties of Bug
- TriangleBug delegates methods it does not know how to do to Bug
- KnightCritter extends Critter extends Actor (implicitly extends Object)
- Binary Search Trees
- NullPointerException (i.e., making sure objects are not null before using them
- Randp