Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 '.class' expected compiler error
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Justin_




PostPosted: 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();
        }
       
       
    }
}
Sponsor
Sponsor
Sponsor
sponsor
HellblazerX




PostPosted: 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.
Justin_




PostPosted: Wed Mar 29, 2006 4:43 pm   Post subject: (No subject)

oh jees, oops.
wtd




PostPosted: 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.
rizzix




PostPosted: Wed Mar 29, 2006 5:37 pm   Post subject: (No subject)

eclipse eclipse! (not for newbies though)
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: