我的问题很简单,为什么如果我选择 + m 不加,如果我选择 -
在这里感谢所有帮助。在此先感谢,我在这里做错了什么,我知道我在正确的轨道上
public static void main(String[] args) throws Exception {
int tal1, tal2;
char operator;
Scanner input1 = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
Scanner input3 = new Scanner(System.in);
System.out.println("Write in a 1st integer");
tal1 = input1.nextInt();
System.out.println("Write in 2nd intger");
tal2 = input2.nextInt();
System.out.println("Do you want to add or subtract please choose + or -");
operator = (char) input3.nextInt();
if (operator == '-') {
System.out.println("Tal1 - Tal2 = " + (tal1 - tal2));
} else if (operator == '+') {
System.out.println("Tal1 + Tal2 = " + (tal1 + tal2));
}
System.out.println("Wrong thing to do buddy");
}