java课后作业

程序源代码:

public class NumberOfObject 

{
public static int count=0; 

NumberOfObject()
  {

count++;
System.out.println("Constructor is going on!!!");

  } 

public static void main(String args[])
  {
NumberOfObject Obj1=new NumberOfObject();
NumberOfObject Obj2=new NumberOfObject();
NumberOfObject Obj3=new NumberOfObject();
NumberOfObject Obj4;
System.out.println("Number Of Object is:"+NumberOfObject.count);
   }

}

程序运行结果:

 

posted @ 2017-10-20 22:59  月影小歪  阅读(89)  评论(0编辑  收藏  举报