3.课后作业


public class Lei {
static int x=0;
//生成一个对象就自加加
public Lei()
{
x++;
}public static void main(String[] args)
{
Lei L1=new Lei();
Lei L2=new Lei();
Lei L3=new Lei();
Lei L4=new Lei();
Lei L5=new Lei();
Lei L6=new Lei();
Lei L7=new Lei();

System.out.println("创建对象数量"+x);
}
}

 

posted @ 2017-10-20 17:50  kid雨眸  阅读(94)  评论(0编辑  收藏  举报