Question: What is wrong with the following code? Correct it. public class Circle{ private double radius; public Circle(double radius){ radius = radius; } public double getArea(){

What is wrong with the following code? Correct it.

public class Circle{

private double radius;

public Circle(double radius){

radius = radius;

}

public double getArea(){

return radius* radius*Math.PI;

}

class B extends Circle{

private double length;

B(double radius, double length)

{

Circle(radius);

length = length;

}

public double getArea(){

return getArea()*length;

}

}

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