Question: Consider the following class hierarchy: public final class Shape { private String mycolor; public Shape ( String mycolor ) { } this.type = mycolor; public
Consider the following class hierarchy:
public final class Shape
private String mycolor;
public ShapeString mycolor
this.type mycolor;
public String getColor
return mycolor;
public class Triangle extends Shape
public TriangleString mycolor
supermycolor;
What is wrong with this class hierarchy definition?
It is not possible to use
in the
constructor.
There cannot be any subclasses of the
class.
There should be more subclasses of the
class than just
Triangle.
Nothing is wrong with the code.
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
