| Author |
Error on program.
|
Julie Mendez
Greenhorn
Joined: Oct 04, 2004
Posts: 7
|
|
I am using this code to make my ants move in all different direction {o-0=up, 1=down, etc.} but it keeps coming up w/ an error. int move; public void init() { move = 3; while ( ( move < 0 ) || ( move > 3 ) ) { (int)(Math.random() * move ); } } error message :::::::C:\Documents and Settings\Ashia\Desktop\INSY 3300\Homework\hw3.java:22: not a statement (int)(Math.random() * move ); ^ 1 error :::::::
|
<b><i>To err is human but to really mess up the things you need a computer </b></i>
|
 |
Jeff Bosch
Ranch Hand
Joined: Jul 30, 2003
Posts: 804
|
|
Try assigning the cast value to a variable. That's what the compiler's looking for. By the way, you'll soon get a message from one of the sheriffs that your name violates the JavaRanch rules for names. You may want to change that before they 'cuff you. [ October 04, 2004: Message edited by: Jeff Bosch ]
|
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
|
 |
Julie Mendez
Greenhorn
Joined: Oct 04, 2004
Posts: 7
|
|
ty and ty
|
 |
Jeff Bosch
Ranch Hand
Joined: Jul 30, 2003
Posts: 804
|
|
YW YW!
|
 |
Chengwei Lee
Ranch Hand
Joined: Apr 02, 2004
Posts: 884
|
|
Hi Julie, You should assign the new computed value back to your 'move' variable. If you don't, your ants won't get a new movement
|
SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
|
 |
 |
|
|
subject: Error on program.
|
|
|