运行客户端程序就是args.length == 0
哪里出错了?
```public class ClientMain {
public static void main(String[] args) throws IOException {
if (args.length == 0){
System.out.println("You did not specify the method of performing the calculations: net or local");
return;
}
IProxy proxy;
String option = args[0];
if (option.equals("net"))
proxy = new NetProxy();
else if (option.equals("local"))
proxy = new CalculatorProxy();
else {
System.out.println("unknown input parameter: " + option);
return;
}
Scanner scanner = new Scanner(System.in);
System.out.print("Enter x: ");
double x = scanner.nextDouble();
System.out.print("Enter y: ");
double y = scanner.nextDouble();
double result = proxy.multiply(x, y);
System.out.println("Multiplication result: " + result);
}
}
在运行的时候传参数了吗?https://www.cnblogs.com/zhangtan/p/8124650.html
你执行程序的时候有没有带上参数(注意是运行时候指定参数,而不是程序运行后输入)
程序前面要先声明参数,你这个程序直接执行第一句if语句,没有参数,所以要报错