There are 3 types of Throwables in Java.
- Checked
Exceptions (Exceptionand down the chain, save forRuntimeException). These are checked by the compiler and must be caught when thrown. They represent an exceptional condition that is usually recoverable, e.g. when a referenced file is not found on the file system (seeFileNotFoundException). - Unchecked or runtime
Exceptions (children ofRuntimeException). These can be thrown without catching. They typically represent programming errors, for instance invoking methods on anullobject (seeNullPointerException). Errors. These are unchecked as well. They are thrown by the JVM when something very wrong is happening, typically beyond the developer's direct control (e.g. out of memory, seeOutOfMemoryError). Compiler errors are issued by the Java compiler when your code fails to compile, for various reason such as bad syntax, ambiguous calls, failing to catch a checkedException, etc. etc.
Videos
There are 3 types of Throwables in Java.
- Checked
Exceptions (Exceptionand down the chain, save forRuntimeException). These are checked by the compiler and must be caught when thrown. They represent an exceptional condition that is usually recoverable, e.g. when a referenced file is not found on the file system (seeFileNotFoundException). - Unchecked or runtime
Exceptions (children ofRuntimeException). These can be thrown without catching. They typically represent programming errors, for instance invoking methods on anullobject (seeNullPointerException). Errors. These are unchecked as well. They are thrown by the JVM when something very wrong is happening, typically beyond the developer's direct control (e.g. out of memory, seeOutOfMemoryError). Compiler errors are issued by the Java compiler when your code fails to compile, for various reason such as bad syntax, ambiguous calls, failing to catch a checkedException, etc. etc.
Any "famous website" that said that should not be read. It is rubbish. There is no such thing as a "compile time exception". The Java Geeks you were talking to are correct1.
Actually, you probably misread or misunderstood what you read on those "famous sites". There are "compile time ERRORS" and "run time EXCEPTIONS".
In your example, what you have is a couple of compile time error message, that are due to errors in your code. The errors are there because your code does not handle exceptions correctly, but they are ERRORS nonetheless. And they are detected at compile time ... by the Java compiler.
1 ... and maybe it is time to stop using semi-derogatory labels like "geek" for them. It sounds like they deserve some respect.