Hi, im confused about ioException....what exactly is it and in a method when it says Throws IOException....how does it do that...what has to happen for it to do that? i have a snippet of a code here catch(IOException excpt) well,how does it get into the catch statement?
Here is the link to the Java API that explains IOException. What exactly is it ... it is an Input/Output Exception, meaning some unexpected event regarding I/O happened. There are several events that can happen to cause this exception to be thrown A method that declares it "throws IOException" is telling the caller that "if things don't go as planned in this method, I will notify you by throwing this exception". The catch code you included in your post is part of the caller's source file, not the method that is declaring it throws IOException. Hope that helps, Scott
It is the soldier who salutes the flag, who serves beneath the flag, and whose coffin is draped by the flag, who allows the protester to burn the flag.
First of all, while you may view the classes in the java.io package as system code, the operating system views them as application code, mostly written in Java. So when one of the methods in java.io detects an error (often based on the return code from a call to the operating system, based in turn on an electronic signal from a physical IO device such as a disk drive), it will execute just as you could do. Once the exception is thrown, the JVM checks for a corresponding catch block in the current code. If none is there, the JVM "pops the stack" and checks if the calling program has a catch block for this exception. Once a catch block for java.io.IOException is found, any lower level method invocations are dropped and the catch block is called with the IOException object, containing information about the error, passed as an argument. If even the "main" method doesn't catch the exception, the JVM terminates the program and displays some information on the screen.