+ 1
What is the exact difference between checked and unchecked exceptions?
3 Réponses
+ 3
Checked exceptions are those which are checked by the compiler at the time of compiling the code. If these exceptions are not handeled then the source code will not compile.
e.g. FileNotFoundException, InterruptedException,etc
Unchecked exceptions are those which are ignored by compiler at the time of compiling and are interpreted at the run time. If unchecked exceptions are not handeled, then too source code will be compiled but if exception occours at run time than program will terminate.
e.g. NumberFormatException, ArithmeticException, etc
I hope you understand the basic difference. If not, then let me know.
HaPpY LeArNInG 😊
+ 6
Hello, Elias !
These are operators that check(or do not check) the overflow resulting from a numeric operation. The result of the operation exceeds the minimum or maximum value allowed for the data type.
https://www.sololearn.com/Course/Java/?ref=app
+ 3
Unchecked exceptions return errors and end the program. The code finds something wonky and get confused so stops.
Checked exceptions tell the code: there is a possibility this wonkiness may happen, so look out for it.
That way, the if an exception occurs, the code sees it like "oo I have been expecting you" instead of "huh? this is new! what to do!?"