0
When Exceptions occur there runtime or compiletime??
Exceptions
2 Réponses
0
Checked Exceptions are the exceptions that we can typically foresee and plan ahead in our application. These are also exceptions that the Java Compiler requires us to either handle-or-declare when writing code.
The handle-or-declare rule refers to our responsibility to either declare that a method throws an exception up the call stack - without doing much to prevent it or handle the exception with our own code, which typically leads to the recovery of the program from the exceptional condition.
The compiler can detect them before runtime, and you're aware of their potential existence while writing code.
Unchecked Exceptions are the exceptions that typically occur due to human, rather than an environmental error. These exceptions are not checked during compile-time, but at runtime, which is the reason they're also called Runtime Exceptions.
They can often be countered by implementing simple checks before a segment of code that could potentially be used in a way that forms a runtime exception.
0
"exception is an event, which occurs during the execution"
https://docs.oracle.com/javase/tutorial/essential/exceptions/definition.html
exception is something what you can catch (with try-catch statement), and you can do it only in runtime