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
Post a Comment