课后作业3(创建对象)

程序代码:


public class text1 {
public static void main(String arg[])
{
text b=new text();
text c=new text();
text d=new text();
text e=new text();//还可以继续创建
System.out.println("你已经创建了"+text.a+"个对象");
}

}

class text
{
static int a=0;
{
++a;
}
public void add()
{}
}

运行结果截图:

课后作业3(创建对象)

 

相关文章:

  • 2021-11-07
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-06-04
  • 2021-08-29
  • 2021-09-11
  • 2022-02-14
  • 2022-12-23
相关资源
相似解决方案