I am new to Java and I am trying to code a calculator. The numbers are not calculating and I am not sure why that is happening.
Here is my code:
import java.util.Scanner;
public class Calculator {
public static void main(String[] args){
System.out.println("Type in any 2 numbers: ");
Scanner math = new Scanner(System.in);
int number = math.nextInt();
int num2 = math.nextInt();
System.out.println("Which operation would you like to use? (+,-,*,/)");
String oper = math.next();
if (oper == "+"){
int total = number + num2;
System.out.println(total);
}
else if (oper == "-"){
int total = number - num2;
System.out.println(total);
}
else if (oper == "*"){
int total = number * num2;
System.out.println(total);
}
else if (oper == "/"){
int total = number / num2;
System.out.println(total);
}
}
}