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.
Code:
public static void sortNames(String[][2] firstAndLastNames, boolean sortBasedOnFirstName){
}
Any feedback would be helpful, Thank you in advanced.
Re: I keep recieving a token error, How can this be fixed ?
Quote:
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.
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
Re: I keep recieving a token error, How can this be fixed ?
Quote:
Originally Posted by
Daggerfang
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
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
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
Re: I keep recieving a token error, How can this be fixed ?
Quote:
Originally Posted by
Daggerfang
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
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 ?
Re: I keep recieving a token error, How can this be fixed ?
Quote:
Originally Posted by
Daggerfang
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