2 Star 0 Fork 0

BESTI.IS.JAVA2018/20165337

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Pillar.java 450 Bytes
一键复制 编辑 原始数据 按行查看 历史
yueyuan 提交于 7年前 . week4
public class Pillar {
Geometry bottom; //bottom是抽象类Geometry声明的变量
double height;
Pillar (Geometry bottom,double height) {
this.bottom=bottom;
this.height=height;
}
public double getVolume() {
if(bottom==null) {
System.out.println("没有底,无法计算体积");
return -1;
}
return bottom.getArea()*height; //bottom可以调用子类重写的getArea方法
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/BESTI-IS-JAVA-2018/20165337.git
git@gitee.com:BESTI-IS-JAVA-2018/20165337.git
BESTI-IS-JAVA-2018
20165337
20165337
master

搜索帮助