Exception handling is to interrupt processing and perform processing when the program issues an error.
Exceptions are also treated as classes in java. Exception classes are classified into three types: Error Exception Runtime Exception. A method that can raise an exception of the Exception class will result in a compile error unless exception handling is implemented in the caller.
Exception handling in java is implemented by try-catch-finally statement.
If you want to throw the exception handling to the caller instead of the method in which the exception occurred, use the throws statement.
By using the throw statement, you can throw an exception at any time.
You can implement the original exception class by inheriting the Exception class.
Recommended Posts