abalfazl hossein wrote:
Not, it won't do anything with I/O errors.
This class will do several different things if run from the command line
campbell@****-laptop:~/java$ java ExceptionDemo
. . .
campbell@****-laptop:~/java/$ java ExceptionDemo Campbell
. . .
campbell@****-laptop:~/java$ java ExceptionDemo 123
. . .
Each of those executions will produce a different sort of Exception, and you can see the stack traces at the command line. They tell you where the Exception originated, and all the lines it has passed through until it was caught. If yoo delete the catch block and the keyword
try, you can repeat the exercise and see whether you obtain a different stack trace.