2 Answers
+ 16
import java.util.Scanner;
class Calculator {
public static void main(String[] args) {
String str=new Scanner(System.in).next();
if (str.equals("quit")) {
// return;
} else if (str.equals("add")) {
int x = 0;
int y = 0;
int result = x + y; System.out.println(result);
}
}
}
//make object of scanner once & use it to get the word one time only
+ 1
1. You used break instead of return
2. You forgot a semicolon at line 9
3. You wrote = instead of == in the if statements
4. You're trying to add two scanners together instead of two numbers..