What classifies as a recursive function in Java -
does count recursive function...if no, reason. changes classify such...thanks
public class recursion {  public static void recursionfunc(int beginning_value){     if (beginning_value != 0){         system.out.println(beginning_value);         recursionfunc(beginning_value - 1);      } } public static void main(string[] args){     recursionfunc(10); } }      
a function calls itself, directly or indirectly, called recursive. function calls itself, recursive.
here example of recursive functions calls indirectly:
static void funca(int x) {     if (x <= 0) return;     if (x % 2 == 0) {         funcb(x-1);     } else {         funcc(x-1);     } } static void funcb(int x) {     funca(x-1); } static void funcc(int x) {     funca(x-2); }      
Comments
Post a Comment