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 Shape(String mycolor)
{
}
this.type = mycolor;
public String getColor()
{
}
return mycolor;
}
public class Triangle extends Shape
{
public Triangle(String mycolor)
{
}
super(mycolor);
}
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.
Consider the following class hierarchy: public

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 Programming Questions!