Question: QUESTION 1 In Java, inheritance is a ______ relationship. has-a is-a primogenitive nepotistic QUESTION 2 A class' protected members can be accessed by the class
QUESTION 1
-
In Java, inheritance is a ______ relationship.
has-a
is-a
primogenitive
nepotistic
QUESTION 2
-
A class' protected members can be accessed by the class itself, by any of its subclasses, and by other classes in the same package.
True or False?
A subclass can invoke its superclass' implementation of a method explicitly by preceding the method invocation with the keyword super and a .
QUESTION 3
For example:
super.someMethod();
True or False?
QUESTION 4
- The following code indicates that B extends (inherits from) A:
public class B : A {
// ...
}
True or False?
QUESTION 5
-
If a class does not explicitly extend another, it implicitly extends Object.
True or False?
QUESTION 6
-
The ______ annotation indicates that a method should override a superclass method.
QUESTION 7
-
Use of protected instance variables undermines encapsulation: a small change in the superclass may "break" a subclass' implementation.
True or False?
QUESTION 8
-
When a superclass method is overridden in a subclass, the subclass version may invoke the superclass version to do a portion of the work.
True or False?
QUESTION 9
-
When objects of a particular class must be compared for equality, the class should override Object's equalsmethod to compare the contents of the two objects.
True or False?
QUESTION 10
-
The default implementation of Object's clone method performs a ___________ copy, copying the instance variable values and references from one object into another of the same type. clone may be overridden to perform a ______________copy, creating a new object for each reference-type instance variable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
