What is the exact difference between checked and unchecked exceptions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the exact difference between checked and unchecked exceptions?

13th Jul 2018, 5:39 PM
Elias
Elias - avatar
3 Answers
+ 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 😊
13th Jul 2018, 7:57 PM
Jain Rishav Amit
Jain Rishav Amit - avatar
+ 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
13th Jul 2018, 5:52 PM
Alexander Sokolov
Alexander Sokolov - avatar
+ 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!?"
13th Jul 2018, 6:32 PM
Andre Daniel
Andre Daniel - avatar