A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© an3077458 中级黑马   /  2015-9-17 21:50  /  165 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

public class Demo2
{
    public static int k = 10;      
        // public static int n = 99;
     
        public static Demo2 t1 = new Demo2("t1");   
                                          
        public static Demo2 t2 = new Demo2("t2");  
                                        
   
        public static int i = print("i");  
                                       
        public static int j = print("j");   


        public static int n = 99;         
    {
        print("constructor code");
                                          
    }                                          
    static {
        print("static code");
    }
    public static int print(String s) {
        System.out.println("i="+i +"   "+s+ "  k=" + k + "  n=" + n + "   j=" + j);
        ++i;            
        ++k;
        ++n;
        return i;
    }
    public  Demo2(String string)
        {       
        print(string);
    }
    public static void main(String[] args) {   
        Demo2 d=new Demo2("T");   
    }
}
闲着没事就看看

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马