So been studying for my past exam and come across this question which asks what will the return value be if num = 7? Plugging it into BlueJ tells me 16, what does the func1 do to make it 16? How can the method declared be used again within the method? I searched but hard to find this exact example as it all comes up with just using methods normally.
Thanks,
public int func1(int num)
{
if ( num <= 2 ) return 1;
return func1(num – 2) + num;
}