例题4-2
class Circle{
double radius;
double getArea(){
double area=3.14*radius*radius;
return area;
}
}
public class Example4_2{
public static void main (String args[]){
Circle circle;
circle=new Circle();
circle.radius=163.16;
double area=circle.getArea();
System.out.printf("半径是%5.3f的圆的面积:\n%5.3f\n",circle.radius,area);
}
}