19

package room1;

class circle{
public static double pi=3.1415926535;
float radius;
float x,y;
circle(float r,float x,float y){
radius=r;
this.x=x;
this.y=y;
}
void display(){
System.out.println("The circle's area is: "
+pi*Math.pow(radius,2));
}
double getarea(){
return pi*Math.pow(radius,2);
}

public static void main(String[] arguments){
circle a=new circle(2.5F,0,0);
a.display();
System.out.println(a.getarea());
}
}

posted on 2017-03-11 21:45  tuzhuo  阅读(79)  评论(0编辑  收藏  举报