My program's not working. What do you think is wrong?
Scanner in = new Scanner(System.in);
System.out.print("Enter first number: ");
double num1 = in.nextDouble();
System.out.print("Enter second number: ");
double num2 = in.nextDouble();
System.out.println("Enter operation to perform: ");
String oper = in.next();
if(oper == "add" || oper == "addition" || oper == "+") {
double sum = num1 + num2;
System.out.printf("The sum of the two numbers is %d", sum);
}
When I type the operation(which is a String), program terminates. Output:
Enter first number: 12
Enter second number: 8
Enter operation to perform:
"add"
Process completed.
I can't seem to find the error, please help?