Question: I don't see what's wrong with my switch statement. It's in Java. public int switchCase( int []values) { int sum = 0; switch (sum){ case
I don't see what's wrong with my switch statement. It's in Java.
public int switchCase( int []values) { int sum = 0; switch (sum){ case 1: if(sum == 1) System.out.println("you must subtract 4"); break; case 2: if(sum == 2); System.out.println("you must add 6"); break; case 3: if(sum == 3); System.out.println("you must add6"); break; case 4: if(sum == 4); System.out.println("you must add6"); break; case 5: if(sum == 5); System.out.println("you must add the value"); break; case 6: if(sum == 6); System.out.println("you must add the value"); break; case 7: if(sum == 7); System.out.println("you must add the value"); break; case 8: if(sum < 8) System.out.println("you must add the value * 5"); break; } return sum; }
private boolean sum(int x, int y, int z) { return false; }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
