Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: gridworld error: " ';' expected"

  1. #1
    Member
    Join Date
    Aug 2013
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gridworld error: " ';' expected"

    Here is my code and as you can guess, I get the above error. Thanks for the answer. I'd really appreciate if you could also explain why gridworld has such a low functionality level. Is this a learning thing? I know I wouldn't be able to do as much as an expert would as a student, but there doesn't seem to be a lot to do in gridworld in terms of tweaking.

     
    Location loc1 = new Location( 10, 3 );
     
    Location loc2 = loc1.getAdjacentLocation( Location.WEST );
     
    Location loc1.getAdjacentLocation(SOUTH);
     
    Location loc1.getAdjacentLocation(NORTHEAST);
     
    (new Location(2, 5)).getAdjacentLocation(NORTHEAST);
     
    (new Location(2, 5)).getAdjacentLocation(52);
     
    (new Location(2,5)).getAdjacentLocation(0);
     
    System.out.println( "loc1 = " + loc1 );
     
    System.out.println( "loc2 = " + loc2 );


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,373
    My Mood
    Mellow
    Thanks
    143
    Thanked 598 Times in 585 Posts

    Default Re: gridworld error: " ';' expected"

    I don't know gridworld, but I know that the following is not a legal Java statement:

    Location loc1.getAdjacentLocation(SOUTH); // times 2

  3. #3
    Member
    Join Date
    Aug 2013
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: gridworld error: " ';' expected"

    How would I do that then? What other options do I have in terms of a line of code?

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,373
    My Mood
    Mellow
    Thanks
    143
    Thanked 598 Times in 585 Posts

    Default Re: gridworld error: " ';' expected"

    I'm not sure what you mean to do with those statements, but a proper form would be:

    Type variableName = methodName();

    What you have is missing something.

Similar Threads

  1. Replies: 2
    Last Post: June 22nd, 2013, 10:30 AM
  2. [SOLVED] Syntax error on token "extends", throws expected
    By Purple01 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 16th, 2012, 06:29 AM
  3. Replies: 3
    Last Post: December 7th, 2011, 01:03 AM
  4. Why the error said "few parameters expected 7" while i only have 6 fields?
    By Hafiz Mughni in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 9th, 2011, 10:45 AM
  5. Error of "class or interface expected" at Mylong class for problem of API's
    By lostgoat in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 22nd, 2009, 08:28 PM

Tags for this Thread