java - 为什么在 * 作为参数时会出错
问题描述
class Simcal1{
public static void main(String []args){
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[2]);
char ch = args[1].charAt(0);
switch(ch){
case '+':System.out.println("Addition :" + (a+b) );
break;
case '-':System.out.println("Subtraction :" + (a-b) );
break;
case '/':System.out.println("Division :"+ (a/b) );
break;
case '*':System.out.println("Multification :"+ (a*b) );
break;
default:System.out.println("Enter valid choice");
}
}
}
为什么我在给出 5 * 5 作为参数时出现错误?但在其他情况下为 4 + 5 它工作正常。
解决方案
推荐阅读
- ios - ld:未找到架构 x86_64(领域)的符号
- php - error_reporting(E_ALL) 失败,没有日志或错误消息
- python - 尝试在 pip 的帮助下安装 python 包
- ios - 在 iOS 中调试时推送 viewController 不起作用
- excel - 合并后用工作簿名称命名工作表?
- python - python中声明方法(&self)的问题
- oracle12c - OBIEE 12c。在具有 XML 权限的标题中创建自定义链接
- ssl - 如何识别证书未知错误背后的原因
- javascript - 无法从 Promise 中检索数据
- kubernetes - 如何将 ConfigMap 配置与 Helm NginX Ingress 控制器一起使用 - Kubernetes