While writing programs if the programmer doesn’t know what kind of exception the program might raise, the catch all block can be used. It is used to catch any kind of exception. Syntax of catch all block is as follows: 1 2 3 4 5 catch(...) { //Code to handle exception ... } While writing multiple catch statements care should be taken such that a catch all block should be written as a last block in the catch block sequence. If it is written first in the sequence, other catch blocks will never be executed. Following program demonstrates
The post How to catch every exception in a program appeared first on Coding Security.
How to catch every exception in a program
read more
Tidak ada komentar:
Posting Komentar