1.throwsIt means that the method throws an exception that needs to be handled by the caller. If it doesn’t want to be handled, it will always be thrown outward, and finally it will be handled by the jvm.
2.try catch It is to catch the exception thrown by others, and then deal with it in catch.
In general, the second case is better, so that the cause of the anomaly can be clearly seen and corrected.