Friday, January 20, 2017

Syntax error on tokens, FormalParameter expected instead

Leave a Comment

Error "Syntax error on tokens, FormalParameter expected instead" is on the dataLength and initialValue parameters (before running, as an underline squiggle). I have also ran clean on the project. Error appears on Luna and Juno of Eclipse, multiple JRE's (1.8-1.7), and multiple workspaces-so I'm guessing it is something on the machine. This machine is Windows 10. This error was not present before. The only thing I can think of on the machine that has changed is installing programs, such as Google Cloud SDK and AWS SDK for Eclipse. I tried uninstalling those and it is still not working.

public class Main {    public Byte[] LCG(Byte[] data, int dataLength, Byte initialValue){     return data;   }   public static void main(String[] args) {    } } 

1 Answers

Answers 1

I ended up with this problem because I copied the function signature from an assignment which was in a pdf file. I copied the signature because it was essentially the template for the assignment. But it ended up copying the text format of the string ", int dataLength, Byte initialValue" that was not compatible with Eclipse. I guess it was some wrong type of UTF, or something.

So it had nothing to do with the JDK, in fact the error appeared without a JDK compiler installed.

I just had to delete the text and retype it in Eclipse, and the error went away.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment