Question: Multiple inheritance occurs when a derived subclass inherits features from more than one parent class. For instance, you can say that a square is-a rectangle,
Multiple inheritance occurs when a derived subclass inherits features from more than one parent class. For instance, you can say that a square is-a rectangle, but it is also true that a square is-a rhombus. The square inherits features from both the rectangle and the rhombus. Which of the following code statements is the syntactically correct way to define the Square class, such that it inherits the features from both the Rectangle class and the Rhombus class?
| a) public class Square extends Rectangle, Rhombus | ||
| b) public class Square extends Rectangle, extends Rhombus | ||
| c) public class Square extends Rectangle && Rhombus | ||
| d) public class Square multiple extends Rectangle, Rhombus | ||
| e) None of the answers are correct, because multiple inheritance is not implemented in Java. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
