почему метод не выполняется после того, как try...catch не нашёл нужного блока catch?

Есть код

class Program
{
    static void Main(string[] args)
    {
        try
        {
            TestClass.Method1();
        }
        catch(DivideByZeroException ex)
        {
            Console.WriteLine(ex.Message);
        }
        finally
        {
            Console.WriteLine("finally in Main");
        }
        Console.WriteLine("end of main");
        Console.ReadLine();
    }

    class TestClass
    {
        public static void Method1()
        {
            try
            {
                Method2();
            }
            catch(IndexOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.WriteLine("finally in method1");
            }
            Console.WriteLine("end of method1");
        }

            static void Method2()
            {
                try
                {
                    int x = 8;
                    int y = x / 0;
                }
                finally
                {
                    Console.WriteLine("block finally in method2");
                }
                Console.WriteLine("end of method2");
            }
    }
}

почему методы 2 и 1 не продолжают выполняться после того, как в них не нашлось нужного блока catch для обработки исключения из метода2?


Ответы (0 шт):