throws IOException after the method signature
I would like to get a more detailed explaination what you did as you added that "throws IOException" after the method signature of promptAction().
I only know throwing exceptions explicitly by "throw new Exception()" or the automatically way. Since I come from C#.NET I actually never saw that way with the method signature.
Does it maybe mean that whatever Exception is gonna occur in this method it will always unwind with an IOException back to the method caller/client ?
Thanks for your help in advance
Craig DennisTreehouse Teacher
It means that the future caller of the method will need to handle it. If you don't put that in the definition it means you need to handle it. It won't compile without it. Try removing it and check the compilation error. Basically imagine it as passing the buck because you aren't exactly sure how the caller of your method would want the problem to be handled. Here's a pretty good explanation of the practice.
The only types of exceptions that don't require this logic are Runtime (or unchecked) Exceptions. And that too is debatable.
Nicolas HamptonTreehouse Staff
I also looked it up, and each method has a list of exceptions it automatically throws at the bottom of the java documentation at the oracle website. Ex: See the bottom of the long documentation for the readLine method for BufferedReader: http://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html