Consider the following function:
public void dosomething (int n) {
if (n > 0) {
dosomething(n - 1);
System.out.print(n);
}
}
What will be printed when dosomething(5) is called?
(Either write a sequence of numbers, or write "infinite
recursion".)
12345
The print command will be executed when the recursive call reaches the base case, and then each time coming back back.