Instead of exception handling why dont i just correct the code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Instead of exception handling why dont i just correct the code

exception

7th Oct 2018, 8:03 AM
Andrew
Andrew - avatar
2 Answers
0
exception handling is mostly used when input is required
7th Oct 2018, 9:13 AM
Juan Sotomayor
Juan Sotomayor - avatar
0
Not all exceptions are compiling errors from code. For instance, if you want to get data from a corrupt or improperly formated file on your desktop, a runtime exception will be thrown based on an input streams inability to process it. This is something you cannot necessarily predict/solve with a few lines of code . Which is why exception handling can be used to give coders the ability to handle such exceptions, if they occur, freely or what is commonly known as "gracefully".
19th Oct 2018, 7:21 PM
jobba