Need help on following questions 1 What happens if in a catc
Need help on following questions.
(1) What happens if in a catch block heading only the data type is specified, that is, there is no catch block parameter?
(2) Which classes are directly derived from the class exception?
(3) If you define your own exception class, what is typically included in that class?
Solution
1.What happens if in a catch block heading only the data type is specified, that is, there is no catch block parameter ?
The catch block syntax :-
catch(datatype parameter) //catch block heading
{
//exception-handling code
}
If in a catch block heading only the data type is specified, that is, there is no catch block parameter.
Then the thrown value which is thrown in the try-block can not be accessible in the catch block exception handling code. why because the thrown value which is thrown in the try blockshould be stored in the catch block parameter.
