Describing Exceptions

By: Jesse Miller

An exception is an erroneous situation that occurs during program execution. Exceptional situations arise when an operation cannot be completed normally. When an exception occurs in an application, the system throws an error. The error is handled through the process of exception handling.

System.IO.IOException error is thrown when you try to access an illegal stream object. Similarly, if the denominator is zero, an integer division operation throws the System.DivideByZeroException error.

Whenever an error occurs, runtime creates an exception object and sends it to the program in which the exception occurred. This action is known as throwing an exception. The exception object contains information about the type of error.
There are three types of errors that can occur in the application.

These are Syntax errors, Run-time errors, and Logical errors. It is very important to identify the errors for rectification purpose. Rectification can be done only when you know the mistake you have committed.

A syntax error occurs when compiler cannot compile code. Such an error can occur when statements are not constructed properly, keywords are misspelled, or punctuation is omitted. At compilation time all the statements in the application get connected with each other to make a single executable unit.
A run-time error occurs when an application attempts to perform an operation, which is not allowed at runtime.

Division by zero gives you an error during the runtime. A run-time error is also termed as an exception. All the exceptions are defined in the predefined set of classes.

A logical error occurs when an application compiles and runs properly but does not produce the expected results. All the exceptions are derived from the System.Exception class, which is the parent class of all exceptions. There are many exception classes which are directly or indirectly derived from the System.Exception class.

Some of the exception classes derived from the System.Exception class are the System.ApplicationException and System.SystemException classes. The system.ApplicationException class is forwarded by a user program, and not by the CLR. If any user-defined application requires its own exception, it should inherit the exception from the ApplicationException class.

The System.SystemException acts as a base class for all the predefined system exceptions.
Handle exceptions in your program by using an exception-handler. This handler processes the exception. In exception handling, the application is divided into blocks of code.

Quick Note: Taking the Nonsense out of looking for the right spyware remover

If you really want to take the work out of looking for that right Spyware Protection from a go to the Internet and get a or a Free
Download, In order to prevent your vital information from being ripped from your computer get your Remover Today.

A block that shows the probability of raising an error may contain one or more exception handlers

Top Searches on
Computers
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 

» More on Computers
 



Share this article :
Click to see more related articles