Im setting up a simple method and I keep getting the following error:
Syntax error on token “double”, @ expected
Here is my method:
public double Calculate () {
}
The method is just a simple calculation. I have even tried a very simple method like this:
public void Calculate () {
}
Syntax error on token “void”, @ expected
Eclipse is still giving me the error. What am I missing here?
Thanks!
This error occurs in Java class file without class declaration.
If you want Java class (and probably you want some) you need to do something like this:
If you miss class declaration both your error occurs:
There are 2 errors showing:
There are also The Code Conventions for the Java Programming Language you should learn with language too f.e. method names start with lowercase letter.