1 class Demo111 {
 2       public static void main(String[] args) 
 3       {
 4           double b=getArea(2);
 5           System.out.println("圆的面积为:"+b);
 6 
 7           
 8       }
 9       //需求:写一个方法,计算圆的面积并返回
10       public static double getArea(int r){
11           double area=r*r*Math.PI;
12           return area;
13       }
14 }

 

posted on 2018-07-17 14:15  九九九九  阅读(81)  评论(0编辑  收藏  举报