In an inheritance relationship, this is the general class. |
superclass |
In an inheritance relationship, this is the specialized class. |
subclass |
This key word indicates that a class inherits from another class. |
extends |
A subclass does not have access to these superclass members. |
private |
This key word refers to an object's superclass. |
super |
In a subclass constructor, a call to the superclass constructor must __________ . |
appear as the very first statement |
The following is an explicit call to the superclass's default constructor. |
super(); |
A method in a subclass that has the same signature as a method in the superclass is an example of __________ . |
overriding |
A method in a subclass having the same name as a method in the superclass but a dif-ferent signature is an example of __________ . |
overloading |
These superclass members are accessible to subclasses and classes in the same pack-age. |
protected |
All classes directly or indirectly inherit from this class. |
Object |
With this type of binding, the Java Virtual Machine determines at runtime which method to call, depending on the type of the object that a variable references. |
dynamic |
This operator can be used to determine whether a reference variable references an object of a particular class. |
instanceof |
When a class implements an interface, it must __________ . |
provide all of the methods that are listed in the interface, with the exact signatures and return types specified |
Fields in an interface are __________ . |
both final and static |
Abstract methods must be __________ . |
overridden |
Abstract classes cannot __________ . |
be instantiated |
Constructors are not inherited. |
True |
In a subclass, a call to the superclass constructor can only be written in the subclass constructor. |
True |
If a subclass constructor does not explicitly call a superclass constructor, Java will not call any of the superclass's constructors. |
False |
An object of a superclass can access members declared in a subclass. |
False |
The superclass constructor always executes before the subclass constructor. |
True |
When a method is declared with the final modifier, it must be overridden in a subclass. |
False |
A superclass has a member with package access. A class that is outside the superclass's package but inherits from the superclass can access the member. |
False |
A superclass reference variable can reference an object of a subclass that extends the superclass. |
True |
A subclass reference variable can reference an object of the superclass. |
False |
When a class contains an abstract method, the class cannot be instantiated. |
True |
A class may only implement one interface. |
False |
By default all members of an interface are public. |
True |
This is a method that is automatically called when an instance of a class is created. |
constructor |
Making an instance of one class a field in another class is called ___________. |
aggregation |
What is an "is-a" relationship? |
is a relationship not a has a relationship |
A program uses two classes: Animal and Dog. Which class is the superclass and which is the subclass? |
Animal Super, Dog subclass |
What is the superclass and what is the subclass in the following line? public class Pet extends Dog |
pet is subclass, dog is superclass |
What is the difference between a protected class member and a private class member? |
protected in same package and kids. private only parent. |
Can a subclass ever directly access the private members of its superclass? |
No |
Which constructor is called first, that of the subclass or the superclass? |
SuperClass |
What is the difference between overriding a superclass method and overloading a superclass method? |
parameters. rewrite. |
Reference variables can be polymorphic. What does this mean? |
morph into a reference of object or interface. |
When does dynamic binding take place? |
Run time |
What is an abstract method? |
Makes sure method is implementing by override. |
What is an abstract class? |
generic and other classes inherit from it. |
What are the differences between an abstract class and an interface? |
interface specifies behavior and abstract class is generic. |
When you instantiate an anonymous inner class, the class must do one of two things. What are they? |
implement an interface or extend superclass |
What is a functional interface? |
interface that has one abstract method. |
What is a lambda expression? |
creates object that implements functional interface. |