Java Reference
In-Depth Information
javac: Missing Semicolon
src/helloworld/ ';' expected
We forgot the semicolon at the end of the import line. It should be this:
However, this error message isn't always foolproof. For instance, if I leave off
the opening brace, {, of a code block by mistake, like this:
public void disable() "Stopping." );
I'll get a slew of errors, starting with “missing semicolon” and continuing on
to the next several lines of code, past our initial error:
src/helloworld/ ';' expected
public void disable()
src/helloworld/ class , interface, or enum expected
public void helloCommand(MessageReceiver caller, String[] parameters)
The compiler is confused: it thinks maybe we should have had a semicolon
after onDisable() , but actually we needed an opening brace, {. Then it has no
idea what's supposed to be happening, and it starts complaining that the
entire rest of the file is not what it expected.
That's why in most cases you only want to read the first one or two errors
and ignore the rest for the moment, as many of the following errors will dis-
appear once you fix the first one.
Search WWH ::

Custom Search