2017-03-19|1138阅|作者:一只来自南方的鬼|举报 摘要:package experiment;
public class CircleArea {
public static void main(String[] args) {
double radius = 0, area;
if (args.length <= 0) {
S
package experiment;
public class CircleArea {
public static void main(String[] args) {
double radius = 0, area;
if (args.length <= 0) {
System.out.println("程序运行时未给定参数,程序运行结束!");
} else {
radius = Double.parseDouble(args[0]);// 从输入参数中获取圆的半径
area = Math.PI * radius * radius;// 计算指定半径的圆的面积
System.out.println("半径为:" + radius + "的圆的面积为:" + area);//输出圆的面积
}
}
}