What is exception handling

When writing computer programs it’s a very common for programmers to introduce errors in the code. Errors can be of two types – compilation errors and runtime errors. The compilation errors are easy to find and fix because the compiler won’t let you move to the next step without fixing such errors. The real problem begins when the compiler is not able to find the errors and they show up when the program is in the execution mode. Such errors are called runtime errors or exceptions.

So what is an exception?

When your code gets into an error state at runtime and the program crashes it is called an exception. Exceptions interrupt the normal flow of the program and may cause the program to stop all of a sudden.

What is exception handling?

Exception handling is a technique using which you can intelligently handle the exceptions when they show up and prevent the program from crashing. Using this technique you can also inform the user about what happened, note down the reason for the crash in some file or database table and also send some notification like an email to the concerned person with information about such an error.

How can I add exception handling in my code?

Almost all modern day programming languages have the feature of exception handling. To add exception handling capability to your program you should use the try and catch blocks to write your code. You will learn in details about try-catch blocks in the next tutorial.

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp