Hi,
As you know an exception is an error that occurs during the runtime.
Here is a simple exception handling example using C Sharp/C#.
using System; class MainClass{ public static void Main(){ int value= 0; try { int i = 7/value; } catch (DivideByZeroException e) // catching divide by zero exception { Console.WriteLine( "DivideByZero {0}" , e); } catch (Exception e) // catching any other exceptions { Console.WriteLine( "Exception {0}" , e); } } } |