Ask questions and get helpful responses.

Programming

Consider the following code.
public void printNumbers(int x, int y) {
if (x < 5) {
System.out.println("x: " + x);
}
if (y > 5) { System.out.println("y: " + y);
}
int a = (int)(Math.random() * 10);
int b= (int)(Math.random() * 10);
if (x != y) printNumbers(a, b);
}
Which of the following conditions will cause recursion to stop with certainty?
x < 5
x < 5 or y > 5
x != y
x == y

  1. 👍
  2. 👎
  3. 👁
  4. ℹ️
  5. 🚩
  1. the only time recursion occurs is if x != y
    so ...

    1. 👍
    2. 👎
    3. ℹ️
    4. 🚩
    👤
    oobleck

Respond to this Question

First Name

Your Response

Still need help? You can ask a new question.