Click to See Complete Forum and Search --> : i got a question...


divine1200
04-27-2005, 03:56 PM
lets say i was asked this question...
"Write a class named PrintArgs that contains a method main() that can be run from the command line that prints the arguments it receives in reverse order?"
I did this....
public class PrintArgs

{

public static void main(String[ ] args)

{

for (int i = 0; i < args.length; i++)

System.out.println(args[ i ] );

}

}

...now I was wondering how I get it to answer the question correctly? (actually print it out in reverse order.)

sjalle
04-27-2005, 04:42 PM
Viola !

for (int i =args.length-1; i >= 0; i--)
System.out.println(args[ i ] );

meisl
04-27-2005, 05:32 PM
Actually, it's "voilą". Or were you just greeting your girl-friend? ;)

sjalle
04-27-2005, 05:39 PM
Two things stopped me from getting that correct:
1: I have mislaid my glasses, (will buy new ones soon)
2: I don't know how to make the little accent over the letter....

BTW have you checked my forest ?

sjalle
04-27-2005, 05:41 PM
http://home.no.net/sjalle/forestPage.html

meisl
04-27-2005, 06:46 PM
Yes, I have. Gfx look somewhat more decent than in minesweeper... Ooops, no offence!
Well, I didn't follow up the deer'n'hunter thread, so I'm not up-to-date. What's the meaning of the white and light-blue bars for deer/hunter? Life-expectance, hunger indicator?
Looks interesting, indeed.

sjalle
04-27-2005, 06:56 PM
Well, the graphics in Forest are not really there, its just plain rectangles, colors and
text, but that will change ... moooahahhaaa.

The blue is time left berfore repoduction, the white is lifetime left, so, yes, the white
is an "inverse" hunger indicator, and the blue is an "inverse" eagerness indicator, hehe