If/Else Simulation
Category: Simulation
Author: Marty Stepp
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 < b) {
a = a * 2;
}
if (a > b) {
a = a - 10;
} else {
b++;
}
System.out.println(a + " " + b);
}
1) ifElseMystery(10, 3);
2) ifElseMystery(6, 6);
3) ifElseMystery(3, 4);
4) ifElseMystery(4, 20);