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

  1. In Java, inheritance is a ______ relationship.

    has-a

    is-a

    primogenitive

    nepotistic

QUESTION 2

  1. 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

  1. The following code indicates that B extends (inherits from) A:

    public class B : A {

    // ...

    }

    True or False?

QUESTION 5

  1. If a class does not explicitly extend another, it implicitly extends Object.

    True or False?

QUESTION 6

  1. The ______ annotation indicates that a method should override a superclass method.

QUESTION 7

  1. Use of protected instance variables undermines encapsulation: a small change in the superclass may "break" a subclass' implementation.

    True or False?

QUESTION 8

  1. 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

  1. 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

  1. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!