Error vs Exception
Keywords which are used to handle the exceptions are:-
- Try and catch
Syntax of throw:-
Example of throw:-
Try and Catch
Some facts about try catch block ,you should know:
- A try statement can be followed by multiple catch statement.
- We can use nested try catch statements also.
- We can't write any statement between try and catch statements.
- Catch is used only with try but try can be used with finally also.