- Use inheritance in creating classes
- Explain what is meant by "overriding a method"
- Make use of super reference to call a parent method from within a method that overrides it
- Explain the role of the
Object
class - Explain how automatic type promotion works with object references
- Override the
equals()
andtoString()
methods for user defined classes - Explain the relationship between a reference type and the type of the object to which the reference points
- Explain the concept of polymorphism/dynamic binding
- Identify legal and illegal assignments of references to objects based on the reference type and object type
- Explain what it means for a class to implement an interface
- Use the protected modifier in defining an inheritance hierarchy
- Describe when to use an abstract class
Note taking requirement
Don't forget to submit your notes in Canvas prior to classtime.
Reading
- Review chapters 13 and 14
Inheritance Review [2:58]
- What are characteristics of a super class?
- What are characteristics of a sub class?
- What is the is-a relationship?
- What are some motivations for using inheritance?
- Watch the following video [link]
Inheritance Examples in JavaFX [2:46]
- How is inheritance used in JavaFX?
- What is the purpose of the
Control
class? - Do you suspect that the
Control
class is abstract? Why or why not?
- Watch the following video [link]
References in Inheritance [1:19]
- What is the relationship between the reference type and object type?
- Consider the JavaFX class diagram. What reference type could be used to point to any object type in the diagram?
- How does the reference type determine what methods can be called (if at all)?
- How does the object type determine what methods can be called (if at all)?
- Watch the following video [link]
Inheritance and Code Reuse [7:56]
- What is a method provided by the
Control
class? - When does it make sense to implement a class even if you never create objects of that type?
- What is technical debt?
- What should you suspect if a class has abstract or base in the class name?
- Watch the following video [link]
Abstract Classes [6:39]
- When mst a class be declared as abstract?
- What makes abstract methods unique?
- Can you create abstract instance variables?
- Explain how a class can claim to implement an interface without providing an implementation for all of the methods in the interface.
- Why use abstract classes?
- Watch the following video [link]
Casting References and Visibility Modifiers [5:13]
- When does implict type casting happen with references?
- When is an explict type cast necessary with references?
- What happens if you try to cast an object to an incompatible class? When will this error be identified?
- What does the
protected
visiblility modifier signify?
- Watch the following video [link]
Interfaces [5:49]
- What can an interface reference refer to?
- What does it mean to declare a class as final?
- What is meant by a can-do relationship?
- Watch the following video [link]