Solved

Given the Following Class Code: Public Class RecurseMore

Question 107

Multiple Choice

Given the following class code: public class RecurseMore
{
Private static int total;
Public static void main(String[] args)
{
System.out.println(recurse(4) ) ;
}
Public static int recurse(int n)
{
Int total = 0;
If (n == 0)
{
Return 0;
}
Else
{
Total = 4 + recurse(n - 2) ;
}
Return total;
}
}
What values will be printed when this code is executed?


A) 0, 4, and 8
B) 4 and 8
C) 4
D) 8

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions