Java方法4-4练习,烦请老师检查和指正~
package imooc_redo_exercise;
public class AreaDemo {
public double area(double r) {
double area = Math.PI * r * r;
return area;
}
public int area(int a, int b) {
int area = a * b;
return area;
}
public static void main (String args[]) {
AreaDemo ad = new AreaDemo();
double r = 4.5;
int a = 8, b = 5;
System.out.println("The area of a circle is: " + ad.area(r));
System.out.println("The area of a rectangle is: " + ad.area(a, b));
}
}
33
收起
正在回答
1回答
同学你好,已完成练习,逻辑清晰,继续加油!
祝学习愉快~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星