package aaa;
public class Circle {
private double radius;
public Circle(){
radius = 1;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
public double findArea(){
return Math.PI *radius*radius;
}
}
package aaa;
public class Cylinder extends Circle {
private double length;
public Cylinder(){
length= 1;
}
public double getLength() {
return length;
}
public void setLength(double length) {
this.length = length;
}
public double findVolume(){
return findArea()*length;
}
}
如题,只想问在代码的最后一行,findArea()*length;自己写的时候没有加(),不知道为啥。。。
|
|