When javac finds a problem, it prints an error in this format:
HelloWorld.java:3: error: ';' expected
System.out.println("Hello")
^
The first part is the file name. The number after the colon is the line number. Then comes the error description. The caret (^) points to the exact position where the compiler got confused.
Always start with the first error. Later errors are often caused by the first one. Fix it, recompile, and see if the remaining errors disappear.
Common beginner errors:
- Missing semicolon at the end of a statement
- Mismatched braces (opened
{but forgot}) - Class name doesn't match the file name
- Misspelled keywords like
SystemorString