Question

List all overloading methods (including constructors) in this coding..


public class Circle {

private double radius;
private String colour;

public Circle()
{
radius = 0;
colour = "";
}

public Circle (double r)
{
radius = r;
}

double getRadius()
{
return radius;
}

double getArea()
{
return Math.PI * radius * radius;
}

public String toString()
{
return "Aread of a circle with radius " + radius + " is " + getArea();
}
}


public class Cylinder extends Circle {
private double height;

public Cylinder ()
{
super();
height = 0.0;
}

public Cylinder(double height) {
super();
this.height = height;
}

public Cylinder(double radius, double height) {
super(radius);
this.height = height;
}

public double getHeight() {
return height;
}

public double getVolume() {
return super.getArea()*height;
}
}




Answers

UUM
HAHA NOOB.

Related Questions