Question: In this java code when i = 1, public static void rec1(int i) { if(i == 0) { System.out.print(i + ); for(int j =
In this java code when i = 1,
public static void rec1(int i) {
if(i == 0) {
System.out.print(i + " ");
for(int j = 0; j < 2; j++) {
rec1(i - 1);
rec1(i - 1);
}
}
How does the for loop keep the program running, printing 0 0 0 0 0 0 0 ...., causing a stack overflow?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
