不会赋值求大佬帮忙
class Circle{ double r ;
Circle( ) { public Circle(1.0) } //无参构造方法,默认半径为1.0
Circle(double a) //有参构造方法
{ (2) }
double Area( ) { return a*a*3.14 }//返回面积
double Girth( ) { return a*2*3.14 }//返回周长
}
class Cone extends Circle{
double h;
Cone()
{ super();
h=1.0;
}
Cone(double rr,double hh){
rr=2;
hh=3; //为半径和高赋值
}
double V() { return rr*rr*3.14*hh/3 }//返回圆锥的体积
}
public class ConeTest{
public static void main(String args[])
{ Cone c1=new Cone();
System.out.println(c1.V());
Cone c2=new Cone(1.0,3.0);
System.out.println(c2.V());
}
}