Results 1 to 9 of 9
  1. #1
    Daggerfang is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default I keep recieving a token error, How can this be fixed ?

    All of the code I have written so far is working, except for this method. I have never heard of a token error before this. The array has to be of that size, is there a better way to set the parameters or solve this error.



    Java Code:
    public static void sortNames(String[][2] firstAndLastNames, boolean sortBasedOnFirstName){
        
    }

    Any feedback would be helpful, Thank you in advanced.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    18,781
    Rep Power
    27

    Default Re: I keep recieving a token error, How can this be fixed ?

    recieving a token error
    Is the error from a Java SE class?
    Have you looked in the API doc for a description of the error?

    Please copy and paste here the full text of the error message.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Daggerfang is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: I keep recieving a token error, How can this be fixed ?

    Syntax error on token "2" delete this token.
    Is all the error says.

    I am checking the API docs right now

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,190
    Blog Entries
    7
    Rep Power
    24

    Default Re: I keep recieving a token error, How can this be fixed ?

    Quote Originally Posted by Daggerfang View Post
    Syntax error on token "2" delete this token.
    Is all the error says.

    I am checking the API docs right now
    Do what the compiler says; the compiler is right, always.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    18,781
    Rep Power
    27

    Default Re: I keep recieving a token error, How can this be fixed ?

    What compiler are you using? I get a different error message with the javac command: error: ']' expected
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Daggerfang is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: I keep recieving a token error, How can this be fixed ?

    When I use Eclipse it gives me the token error.
    When I use Netbeans it gives me the javac command: error: ']' expected.
    either one gives me an error that makes no sense to me

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,190
    Blog Entries
    7
    Rep Power
    24

    Default Re: I keep recieving a token error, How can this be fixed ?

    Quote Originally Posted by Daggerfang View Post
    When I use Eclipse it gives me the token error.
    When I use Netbeans it gives me the javac command: error: ']' expected.
    either one gives me an error that makes no sense to me
    Both are right: Eclipse wants you to remove the '2' and Netbeans expected a ']' instead of the '2'. Eclipse's message is more clear here (imho).

    kind regards,

    Js
    The only person who got everything done by Friday was Robinson Crusoe.

  8. #8
    Daggerfang is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: I keep recieving a token error, How can this be fixed ?

    So if both are right, how would I set the parameters for the array if not in the method ?

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,190
    Blog Entries
    7
    Rep Power
    24

    Default Re: I keep recieving a token error, How can this be fixed ?

    Quote Originally Posted by Daggerfang View Post
    So if both are right, how would I set the parameters for the array if not in the method ?
    Use Eclipse's suggestion and removee the '2' in the parameter declaration.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Syntax error on token "}", super expected
    By amentjacob1 in forum New To Java
    Replies: 9
    Last Post: 07-06-2012, 04:15 AM
  2. Replies: 0
    Last Post: 12-09-2011, 11:28 PM
  3. Syntax error on token
    By egun in forum New To Java
    Replies: 4
    Last Post: 02-11-2010, 11:57 AM
  4. Syntax error on token "(", ; expected
    By romilc in forum New To Java
    Replies: 7
    Last Post: 10-24-2009, 01:23 AM
  5. Error FIxed type attribute not equal
    By phoenix_yadu in forum Advanced Java
    Replies: 2
    Last Post: 04-23-2009, 04:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •