The throws keyword can be used in method definition to let the caller of a method know about the exceptions that the method might raise and which are not handled by that method. The general form of throws is as follows: type method-name(parameters-list) throws exception-list { //body of method } The exception-list is a comma separated list of exceptions that the method might throw. Except the sub classes of Error and RuntimeException classes all other exceptions (checked exceptions) must be mentioned explicitly with the throws keyword. Otherwise, it will lead to compile-time errors. Let’s see a sample program which demonstrates the use of throws keyword: 1 2 3 4 5 6
The post What is the correct requirement to invoke Finally in Exception handling appeared first on Coding Security.
What is the correct requirement to invoke Finally in Exception handling
read more
Tidak ada komentar:
Posting Komentar