0
Instead of exception handling why dont i just correct the code
exception
2 Answers
0
exception handling is mostly used when input is required
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".