zoukankan      html  css  js  c++  java
  • 异常--try..catch

        class Program
        {
            static void Main(string[] args)
            {
                try
                {
                    object obj = null;
                    int N = (int)obj;
                }
                catch(Exception ex)
                {
                    Console.WriteLine("捕获异常:" + ex);
                }
                Console.ReadLine();
            }
        }
    

    try...catch...finally  

        class Program
        {
            static void Main(string[] args)
            {
                try
                {
                    object obj = null;
                    int N = (int)obj;
                }
                catch(Exception ex)
                {
                    Console.WriteLine("捕获异常:" + ex);
                }
                finally//最后执行的语句
                {
                    Console.WriteLine("
    程序执行完毕...");
                }
                Console.ReadLine();
            }
        }
    

      

  • 相关阅读:
    sed
    UCOSIII(二)
    UCOSIII(一)
    IIC
    SPI
    vii
    find
    grep
    Scrum项目4.0
    Scrum项目3.0
  • 原文地址:https://www.cnblogs.com/my-cat/p/7228818.html
Copyright © 2011-2022 走看看