Considering the following algorithm which statement is true
Considering the following algorithm, which statement is true? Assume the variable \'i\' is greater than or equal to zero. Select all that apply.
public static void doSomething(int i) {
doSomething(i);
}
A) It doesn\'t actually do recursion.
B) None of the other options.
C) It can result in infinite recursion.
D) It doesn\'t have a base case, or it has one that doesn\'t execute.
There may be multiple correct answers. Choose all correct ones.
Solution
Answers:
C) It can result in infinite recursion.
D) It doesn\'t have a base case, or it has one that doesn\'t execute.
It is a recursive method only but there is no end for this call. Thus, it will lead to infinite loop and throw stackoverflowexception.
