View Single Post
Old 02-07-2004, 04:40 AM   #2 (permalink)
manalone
Once upon a time...
 
I think the only answer you might need is
Code:
if( (x % 2) == 0)
maybe without the if

A couple of notes:
1) I recommend you look up http://java.sun.com/ and get a compiler (the j2sdk is free), they also have some good tutorials with an actual java implementation.

2) name your variables properly (eg testNum for x, or isEven for s) , please It's a good idea now to get into the habit of clear code.

3) == is to test something = is to assign. That's what the third error means. the other ones relate to the fact that they are just interested in the logic expression, not the actual code (like the return values you gave).

Hope this helps
__________________
--
Man Alone
=======
Abstainer: a weak person who yields to the temptation of denying himself a pleasure.
Ambrose Bierce, The Devil's Dictionary.
manalone is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73