Midterm Exam #1 Topics
The exam is open book and open notes and you are free to use a calculator or whatever other computing devices you feel may aid you, but it is not open-neighbor. You can use a computing device and the Internet to access Blackboard/online books/notes/course website, but not to compile/run programs or to communicate with others online.
Inheritance
- Why use inheritance, how it helps you
- What is inherited (e.g. public, protected)
- public vs. protected vs. private
- Terminology (e.g. derived, base, super, child, sub)
- Invoking super, calling something in the base class
- Overriding a method - must have same signature or overloading happens
Polymorphism
- Idea of overriding a method and the method invoked is based on the object at the time it is created, not the data type of the object
- How polymorphism helps your programs be extensible
- Given a program with some inheritance hierarchy, determine which methods are invoked or could be invoked (some using polymorphism, others not)
- How to define the toString method
- How to define the equals method, including checking object type, how this is used in methods like .contains()
Abstract Classes/Methods
- What is an abstract method? An abstract class?
- Why to make a class abstract
- Why we can't make an instance of an abstract class
- Misconception: can have code in an abstract classes
Interfaces
- Comparison to abstract class
- Multiple interfaces
- Using the Comparable interface
- How this is used in libraries such as Array.sort
Cloning
- Shallow vs. deep copy and problem with references
- Using the cloneable interface and implementing clone()
- Idea of a marker interface, using super.clone()
UML
- Be able to write a class diagram
- Be able to write a sequence, use case, activity, or state transition diagram
Class Design
- Be able to design classes with the proper responsibilities
- has-a vs. is-a relationship to other classes