How to implement try-catch in java

ginualexginualex kottayam
                                  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

Comments

  • edited June 2015

    Try-Catch is used to handle the exceptions in java.

    Exception:
    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:
    http://java.meritcampus.com/t/152/Try-catch-block?tc=mm219

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories