Question: Java SE classes are defined as shown below: class Shape { } class Quadrilateral extends Shape { } class Triangle extends Shape { } If
Java SE classes are defined as shown below:
class Shape
class Quadrilateral extends Shape
class Triangle extends Shape
If the variables below are declared:
Shape shapenew Quadrilateral;
Quadrilateral quadrilateral new Quadrilateral;
Which of the following statements are correct?
a The statement Triangle triTriangle shape; will fail to compile
b The statement Triangle tri Triangle shape; will compile and execute without error
c The statement shapequadrilateral; will throw an exception at runtime
d The statement Triangle tri Triangle shape; will throw an exception at runtime.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
