Question: Consider the following method: public static int method 1 ( int num, int res ) { if ( num = = 0 ) return res;

Consider the following method:
public static int method1(int num, int res){
if (num ==0)
return res;
else
return method1(num -1, num + res);
}
What will be the method return if it is invoked as method1(3,2)
0
8
No output
Infinite recursion

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!