The YouTube video tutorial , will show you how to implement try catch in java.
YouTube link address :::::::::::https://www.youtube.com/watch?v=uE-mITnRAfE
Try-Catch is used to handle the exceptions in java.
Exception is a run-time error in java which occurs due to logical errors in program. Exception is a class in java.
There are two ways of handling the Exception:
1) Throws Keyword
2) Throw Keyword
1) Throws Keyword: It is used to handle exception like DivideByZero, ArrayIndexOutOfBoundsException i.e. exceptions which are system defined.
Example: If you are using BufferedReader in java, IOException is thrown.
2) Throw Keyword:
Throw keyword is sued to handle user defined exceptions Like the age of person should be greater than zero. To achieve this, one must define class extending the Exception keyword.
For more Details Refer following link:
It looks like you're new here. If you want to get involved, click one of these buttons!