Inheritance
Objectives
Applied
- Given the specifications for an application that uses inheritance, create the required classes.
- Given the specifications for an abstract class or method, write the code for the class and the class that inherits it.
- Given the specifications for a final class, method, or parameter, write the code for the class and the class that inherits it.
- Write the code necessary for a class to override the equals method of the Object class so you can test two objects created from that class for equality based on the data they contain.
- Given the Java code for an application that uses any of the language elements presented in this chapter, explain what each statement in the application does.
Knowledge
- In general, explain how inheritance works.
- Explain what it means for a subclass to extend a superclass.
- Explain how inheritance is used within the Java API classes.
- Explain why methods such as toString and equals are available to all objects and when you might override these methods.
- Describe two ways that you can use inheritance in your applications.
- Describe the accessibility that's provided by the access modifiers you can use for the members of a class.
- Explain what polymorphism is and how it works.
- Describe two ways that you can get information about an object's type.
- Explain when it's necessary to use explicit casting when working with objects created from derived classes.
- Explain how abstract classes and methods work.
- Explain how final classes, methods, and parameters work.