If/Else Simulation
Category: Simulation
Author: Stuart Reges
Book Chapter: 4.1
Problem: If/Else Simulation
Consider the following method. public static void ifElseMystery(int a, int b) { int c = 2; if (a + c < b) { c = c + 8; } else { b = b + 10; } if (a + c < b) { c = c + 8; } else { b = b + 10; } System.out.println(b + " " + c); } For each call below, indicate what output is produced.
1) ifElseMystery(4, 15);
2) ifElseMystery(7, 17);
3) ifElseMystery(12, 5);
4) ifElseMystery(16, 8);