Podcast
Questions and Answers
When a Student object is instantiated, the default constructor of its superclass is invoked implicitly to do the necessary ______
When a Student object is instantiated, the default constructor of its superclass is invoked implicitly to do the necessary ______
initializations
To illustrate this, consider the following ______, public static void main( String[] args ){ Student anna = new Student(); }
To illustrate this, consider the following ______, public static void main( String[] args ){ Student anna = new Student(); }
code
The program flow of inheritance: The ______ keyword
The program flow of inheritance: The ______ keyword
super
A subclass can also explicitly call a constructor of its immediate ______
A subclass can also explicitly call a constructor of its immediate ______
Few things to remember when using the ______ constructor call:
Few things to remember when using the ______ constructor call:
This is done by using the ______ constructor call
This is done by using the ______ constructor call
A super constructor call in the constructor of a subclass will result in the execution of relevant constructor from the ______, based on the arguments passed
A super constructor call in the constructor of a subclass will result in the execution of relevant constructor from the ______, based on the arguments passed
For example, given our previous example classes Person and Student, we show an example of a ______ constructor call
For example, given our previous example classes Person and Student, we show an example of a ______ constructor call
The super() call MUST OCCUR AS THE ______ STATEMENT IN A CONSTRUCTOR
The super() call MUST OCCUR AS THE ______ STATEMENT IN A CONSTRUCTOR
The super() call can only be used in a ______ definition
The super() call can only be used in a ______ definition
In Java, all classes, including the classes that make up the Java API, are subclassed from the ______ superclass.
In Java, all classes, including the classes that make up the Java API, are subclassed from the ______ superclass.
A sample class hierarchy is shown below. Superclass - Any class above a specific class in the class ______.
A sample class hierarchy is shown below. Superclass - Any class above a specific class in the class ______.
Once a behavior (method) is defined in a superclass, that behavior is automatically inherited by all ______.
Once a behavior (method) is defined in a superclass, that behavior is automatically inherited by all ______.
A subclass only needs to implement the differences between itself and the ______.
A subclass only needs to implement the differences between itself and the ______.
To derive a class, we use the ______ keyword.
To derive a class, we use the ______ keyword.
Suppose we have a parent class called ______.
Suppose we have a parent class called ______.
Flashcards are hidden until you start studying
Study Notes
Object Instantiation and Inheritance
- When a Student object is instantiated, the default constructor of its superclass is invoked implicitly to do the necessary initialization.
- The program flow of inheritance is illustrated using the
extends
keyword. - A subclass can also explicitly call a constructor of its immediate superclass using the
super
keyword.
Super Constructor Call
- A super constructor call in the constructor of a subclass will result in the execution of the relevant constructor from the superclass, based on the arguments passed.
- The
super()
call must occur as the first statement in a constructor. - The
super()
call can only be used in a constructor definition.
Class Hierarchy
- In Java, all classes, including the classes that make up the Java API, are subclassed from the
Object
superclass. - A superclass is any class above a specific class in the class hierarchy.
- Once a behavior (method) is defined in a superclass, that behavior is automatically inherited by all subclasses.
- A subclass only needs to implement the differences between itself and the superclass.
Class Derivation
- To derive a class, we use the
extends
keyword. - Suppose we have a parent class called
Person
, and we can derive a subclassStudent
from it.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.