package com.imocc;public class initial { /** * @param args */ public static void main(String[] args) { Shape do1 = new Circle(); Shape do2 = new Rectangle(); do1.acount1(); do2.acount2(); // TODO Auto-generated method stub } // TODO Auto-generated method stub }
3 回答
神不在的二月
TA贡献2条经验 获得超0个赞
package com.imocc;
public abstract class Circle extends Shape {
public int r = 4;
public double x ,y;
public void acount1() {
// TODO Auto-generated method stub
x = 3.14*r*r;
y =2 * 3.14 * r;
System.out.println("圆形的周长是:"+ y +"圆形的面积是:"+ x );
}
public void acount2() {
// TODO Auto-generated method stub
}
}
神不在的二月
TA贡献2条经验 获得超0个赞
package com.imocc;
public abstract class Shape {
public abstract void acount1();
public abstract void acount2();
}
添加回答
举报
0/150
提交
取消