java - Recursive and non recursive functions -


i have following code prints true if given number , false if odd.

public static void main(string args[]) {     long x = 2222224;     if (x % 2 == 0){         system.out.println("true");     }else{         system.out.println("false");}       } 

my trouble bit new java, , having trouble differentiating recursive non-recursive functions. above code recursive, if yes, how can write non recursive one.

your method not recursive

recursive method calls e.g:

void mymethod( int counter) {     if(counter == 0)         return;     else {         system.out.println("hello" + counter);         mymethod(--counter);         system.out.println(""+counter);         return;     } } 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -