Could someone explain to me what it returns?

int result2 = negative(-3);       System.out.println("The final answer is " + result2);

       [B]public[/B] [B]int[/B] negative(int num){
         [B]if[/B](num >= 20){
           [B]return[/B] -5;
           [B]return[/B] negative(num + 4) + 2 * num;

Try drawing a flow chart for your code.

Then choose an arbitary starting value. And go through changing each value so they obey each condition. Eventually you'll get to stage where you have to stop and that's your end value.

Recursion, is just a function which calls itself from within itself. A rather crude definition but you get the point.

thanks but sometimes look at last active Date

Nov 25th, 2006


He might have just been hanging around waiting for an answer all this time...


May be now he is the software engineer.......

why not, nobody knows, maybe we'll ask her/his for job on tomorow :-)