If/Else Simulation
Category: Simulation
Author: Victoria Kirst
Book Chapter: 4.1
Problem: If/Else Simulation
For each call below to the following method, write the output that is produced, as it would appear on the console:
public static void ifElseMystery(int a, int b) {
if (a * 2 < b) {
a = a * 3;
}
if (b < a) {
b++;
} else {
a--;
}
System.out.println(a + " " + b);
}
1) ifElseMystery(10, 2);
2) ifElseMystery(3, 8);
3) ifElseMystery(4, 4);
4) ifElseMystery(10, 30);