java 代码块 和 C#的代码块 对比

java 普通代码块   对应   C#普通代码块

        {
            System.out.println("hello");
        }
            {
                Console.WriteLine("hello");
            }

java静态代码块  对应   C#静态构造函数

        static{
            System.out.println("hello");
        }
        static Program()
        {
            Console.WriteLine("hello");
        }

 

posted @ 2017-04-01 10:40  cppwen  阅读(1300)  评论(0编辑  收藏  举报