'.class' expected compiler error
Author |
Message |
Justin_
|
Posted: Wed Mar 29, 2006 3:38 pm Post subject: '.class' expected compiler error |
|
|
with the for loop it does not compile, without it it does.
Java: |
public class Threads1
{
public static void main (String[] args )
{
City city = new City ();
SmarterRobot karel = new SmarterRobot (city, 2, 0, Directions. EAST, 4);
CityFrame frame = new CityFrame (city );
Walls. makeWall(1, 4, 3, city , "WEST");
Walls. makeWall(1, 4, 3, city , "NORTH");
for(int fourTimes = 0; int fourTimes < 4; fourTimes++ )
{
karel. putThing();
karel. move(3);
karel. turnRight();
}
}
} |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
HellblazerX
![](http://www.plamania.co.kr/shopimages/plmtest/2910040000213.jpg)
|
Posted: Wed Mar 29, 2006 4:10 pm Post subject: Re: '.class' expected compiler error |
|
|
Java: |
for(int fourTimes = 0; int fourTimes < 4; fourTimes++)
|
you're redeclaring fourTimes. Just remove the int infront of the second fourTimes and it should work. |
|
|
|
|
![](images/spacer.gif) |
Justin_
|
Posted: Wed Mar 29, 2006 4:43 pm Post subject: (No subject) |
|
|
oh jees, oops. |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Wed Mar 29, 2006 5:23 pm Post subject: (No subject) |
|
|
code: | karel.putThing();
karel.move(3);
karel.turnRight(); |
This really looks like something that might be a good candidate for refactoring out into a method in a suclass of the SmarterRobot class. |
|
|
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Wed Mar 29, 2006 5:37 pm Post subject: (No subject) |
|
|
eclipse eclipse! (not for newbies though) |
|
|
|
|
![](images/spacer.gif) |
|
|