Question 1
Consider the following Java program. When the call stack reaches its maximum depth, which method will be at the top of the call stack?
class Demo { public void alpha(int n) { if (n > 0) { beta(n - 1); } } public void beta(int n) { if (n > 0) { gamma(n - 1); } } public void gamma(int n) { if (n > 0) { gamma(n - 1); } }}
class TestStack { public static void main(String[] args) { Demo d = new Demo(); d.alpha(3); }}alpha ()
beta ()
gamma ()
main ()
