IO streams throws the way to handle exceptions

Sometimes, we can deal with exceptions, but they sometimes, we do not have permission to handle an exception. Or, I can not deal with, I do not deal with.
In order to solve the wrong problem, java view of this situation, it provides another treatment program: thrown.
format:

throws 异常类名
注意:这个格式必须跟在方法的括号后面

note:

尽量不要在main方法上抛出异常

summary:

编译器异常抛出,将来调用者必须处理。
运行期异常抛出,将来调用可以不用处理。
He published 188 original articles · won praise 10 · views 10000 +

Guess you like

Origin blog.csdn.net/Ting1king/article/details/104823127