2 Star 0 Fork 0

BESTI.IS.JAVA2018/20165322wyj

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Cone.java 446 Bytes
一键复制 编辑 原始数据 按行查看 历史
public class Cone<E> {
double height;
E bottom; //用泛型类E声明对象bottom
public Cone(E b) {
bottom = b;
}
public void setHeight(double h) {
height = h;
}
public double computerVolume() {
String s = bottom.toString();//泛型变量只能调用从Object类继承的或重写的方法
double area = Double.parseDouble(s);
return 1.0 / 3.0 * area * height;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/BESTI-IS-JAVA-2018/20165322wyj.git
git@gitee.com:BESTI-IS-JAVA-2018/20165322wyj.git
BESTI-IS-JAVA-2018
20165322wyj
20165322wyj
master

搜索帮助