Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Often the caller has the proper context to deal with the problem where as the code performing the action that generates the exception does not. Let's say that I am a high level program that wants to write some data out to a file. The low level service that I'm calling, let's call it writeFile() can throw an IOException for a variety of reasons.</p> <p>The person who wrote writeFile() is going to have no idea of the context in which writeFile() is going to be used. If writeFile() fails, should it attempt to re-write the file? How many times should it try that? Should it just give up? Because the programmer who wrote the low level function writeFile()'s context in the scheme of accomplishing some task is so far down in the weeds the programmer could not possibly anticipate how the caller would want to handle an error condition.</p> <p>Instead of trying to guess at how the caller would like to have the error handled (an impossible task) the programmer of writeFile() indicates to the client calling writeFile() that there are some "open questions" that need to be answered when problems arise. Each problem is indicated by an exception Class and when the client programmer catches that exception, the client programmer is writing an answer to that open question with the context that the client programmer could never hope to have.</p> <p>In short, if you EVER see a method listing a checked exception, the programmer who wrote that exception is saying "Whomever calls this method will have the proper context to make a decision about what to do with that exceptional condition. I do not."</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload