Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is the difference between Error and Exception?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 98
    Comment on it

    Error is the real something happen from exception. Exception is the way to catch the error. For example when you get the variable let say String str, we got Null Pointer. The error is because our variable has NULL value and it catch with Exception: "Null Pointer Exception".

    Programming errors fall into three categories:

    1-Compilation Errors,
    2-Run-time Errors,
    3-Logical Error


    Compilation Errors:-

    Compilation errors, also known as compiler errors, are errors that prevent your program from running

    Run Time Errors:-

    Run-time errors are errors that occur while your program runs.

    Logic Errors:-

    Logic errors are errors that prevent your program from doing what you intended it to do.


    and exception are the run time error!


    In simple words error can not be handled , but exceptions can be handled, with the help of try and catch.

    try{
    Conditions here...
    }catch(Throwable ex){
    ex.print trace();
    }

    Like this you can catch an exception

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: