Solved

The Following Two Methods Will Both Compute the Same Thing

Question 50

True/False

The following two methods will both compute the same thing when invoked with the same value of x. That is, method1(x) = = method2(x).
public int method1(int x)
{
if (x > 0) return method1(x - 1) + 1;
else return 0;
}
public int method2(int x)
{
if (x > 0) return 1 + method2(x - 1);
else return 0;
}

Correct Answer:

verifed

Verified

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

Related Questions