标签:创建对象 代码 nbsp pre public png ack package 创建
源代码:
package 类的统计; class Num{ private static int n; public Num() { n++; } public static int get() { return n; } } public class Tongji { public static void main(String[ ]args) { Num n1=new Num(); Num n2=new Num(); System.out.println("创建对象的个数为:"+Num.get()); } }
标签:创建对象 代码 nbsp pre public png ack package 创建
原文地址:https://www.cnblogs.com/xuange1/p/9825104.html