Scanner in = new Scanner(System.in);这句错误,求大神
package cn.campsg.java.experiment;public class MainClass {
public static void main(String[] args) {
//获取用户输入的两个数值
System.out.println("请输入用于计算的两个数值,数值间用空格间隔:");
Scanner in = new Scanner(System.in);
double num1 = in.nextDouble();
double num2 = in.nextDouble();
in.close();
//调用加法函数
System.out.println("和为:" + Utils.add(num1, num2));
//调用减法函数
System.out.println("差为:" + Utils.substract(num1, num2));
//调用乘法函数
System.out.println("积为:" + Utils.multiply(num1, num2));
//调用除法函数
double ret = Utils.division(num1, num2);
if(ret < 0)
System.out.println("分母不能为0");
else
System.out.println("商为:" + ret);
}
}