Question: Here is a recursive method: public static int mystery(int i, int[] arr) { if(i == arr.length - 1) return arr[i]; else { int temp =

Here is a recursive method:

 public static int mystery(int i, int[] arr) { if(i == arr.length - 1) return arr[i]; else { int temp = mystery(i+1, arr); if(temp < arr[i]) return temp; else return arr[i]; } }

What is the return value of the following call?

mystery(0,new int[]{5,2,8,4,9});

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!