Compile time error – the java compiler can’t compile the code, often because of syntax errors. Typical candidates:
- missing brackets
- missing semicolons
- access to private fields in other classes
- missing classes on the classpath (at compile time)
Runtime error – the code did compile, can be executed but crashes at some point, like you have a division by zero.
- using variable that are actually
null
(may cause NullPointerException) - using illegal indexes on arrays
- accessing resources that are currently unavailable (missing files, …)
- missing classes on the classpath (at runtime)
(‘Crashes’ is really not the correct term and is only used to illustrate what happens)