Consider the following method.

public static void ifElseMystery1(int x, int y) {
int z = 4;
if (z <= x) {
z = x + 1;
} else {
z = z + 9;
}
if (z <= y) {
y++;
}
System.out.println(z + " " + y);
}
For each call below, indicate what output is produced.
ifElseMystery1(3, 20);

ifElseMystery1(4, 5);

ifElseMystery1(5, 5);

ifElseMystery1(6, 10);

Respuesta :

Answer:

13 21

5 6

6 5

7 11

Explanation:

Above-written are the output produced by the method ifElseMystery1 with the respective outputs.

The method contains one if-else block to change the values of x and y and one if statement to change the value of y.

In the method there is a local variable z initialized with the value of 4  and then it compares it with x if z is less than or equal to x then x is changed to x+1.else the value of z is increased by 9.

In the if statement it compares the value of z with y if the value of z is less than or equal to y then the value of y is increased by 1.