public class ComputerCircleArea{
public static void main(String arg[]){
double radius;
double area;
radius=163.16;
area=3.14*radius*radius;
System.out.printf("%5.3f:\n%5.3f\n",radius,area);
}
}
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);
}
}