Catching and throwing exceptions

Catching is to solve the exception, throwing an exception is thrown to the superior.
For example, the exception of f.createtwNewFile is very likely that the path is wrong, and we can solve this exception. For example, in catch, we System.out.println("The file path does not exist, please enter y, and the path will be created automatically.");

Exceptions are divided into checked and unchecked exceptions. The latter includes error and runtimeexception.

Our titrator exception will require writing three methods. getMessage printStackTrace toString

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324691911&siteId=291194637