[Solved] Error: else without if. What went wrong? [closed]
You should do it with a switch : public static void main(String args[]) { System.out.println(“Enter 1 to Add, 2 to Subtract, 3 to Divide, or 4 to Multiply”); int x = keyboard.nextInt(); switch(x){ case 1: System.out.println(“Enter an integer”); int num1 = keyboard.nextInt(); System.out.println(“Enter another integer”); int num2 = keyboard.nextInt(); System.out.println(“The sum of the numbers equals … Read more