Exception Handling: The Exception Hierarchy 2

image_pdfimage_print
   


using System;

public class ExceptionHierarchyNeverExecuted
{
    static int Zero = 0;
    static void AFunction()
    {
        int j = 22 / Zero;
        Console.WriteLine("In AFunction()");
    }
    public static void Main()
    {
        try
        {
            AFunction();
        }
        catch (DivideByZeroException e)
        {
            Console.WriteLine("DivideByZero {0}", e);
        }
    }
}