Briefly explain the concept of recursion in java with examples
Answers
Answered by
0
recursion means a function calling itself...
for example
private static long factorial(int n)
{ if (n == 1)
return 1;
else
return n * factorial(n-1);
}
for example
private static long factorial(int n)
{ if (n == 1)
return 1;
else
return n * factorial(n-1);
}
Similar questions