When using I/O, the system prompts you to throw an exception when using Fileinputstrean or FileOutputStream.
The method that throws the exception has two kinds of try/catch statements or directly with the throws statement.
With the throws statement, the exception is thrown to the virtual machine for processing, and we do not have to handle the exception ourselves.
Try/catch statement really try to write a statement block in the catch, write an exception, you can customize when the program is thrown when the exception of the content of a more humane, I want to throw anything can be thrown out, get the desired results.
There is also a new throw Exception (), this is a custom mandatory throw exception, as long as the writing of this statement then the program runs to this sentence will throw an exception, so be careful to use.
Java Exception Handling