Next: Run-time errors
Up: B. Dealing with errors
Previous: B. Dealing with errors
Contents
- With errors detected by the compiler always start with the
first and work through them in order, recompiling each time. You may
find that solving the first error will eliminate the rest as
sometimes a simple error at the beginning of a program will cause
many cascading errors later on.
- If the compiler detects an error then look at the details it
gives about which line in the code the error was found and what the
error was. Look carefully at the line of code in your source file --
you may simply have spelled something wrong or omitted a semicolon.
Forgetting a semicolon will tend to result in an error message that
refers to the following line (as it is the following line that then
fails to make sense to the compiler), so you should also check the
lines around the one mentioned by the compiler.
- If the compiler gives an error ``variable not defined'' or
``cannot resolve symbol'' when
you are using some Java feature that you are sure you have spelled
correctly, then the problem could be that you have not got the
necessary import statement at the start of the file.
Next: Run-time errors
Up: B. Dealing with errors
Previous: B. Dealing with errors
Contents
RHUL Dept. of Physics