146k views
5 votes
Given the following declarations,

public class Parent { ... }
public class Child extends Parent implements Wizard { ... }
public class Grandchild extends Child { ... }

Which of the following is NOT true?

a. Child "Is-A" Wizard
b. Parent "Is-A" Wizard
c. Grandchild "Is-A" Child
d. Grandchild "Is-A" Parent
e. Grandchild "Is-A" Wizard

1 Answer

5 votes

Answer:

Option b is a correct answer for the above question.

Step-by-step explanation:

IS-A relationship occurs for a child class when the child class inherits the parent class, then it has been said that "child class "Is-A" Parent class". This can be followed by the interface and class both.

The above question asked that which is not true for the "Is-A" concept. Option b is not true, because it states that the Parent class inherits the Wizard interface, but the question code is not stated like this. Hence option b is correct while the other is not because:-

  • Option a state's child inherits the wizard which is true.
  • Option c states Grandchild inherits the Child which is true.
  • Option d states Grandchild inherit the Parent which is true.
  • Option e states Grandchild inherit the wizard which is true.
User Birb
by
6.5k points