标签:mic 引用传递 color http static成员 使用 inf 分析 class
public class Cat { private static int sid = 0; private String name; private int id; Cat(String name){ this.name = name; id = sid++; } public void info(){ System.out.println("My name is "+name+" No."+id); } public static void main(String[] args) { Cat.sid = 100; Cat mimi = new Cat("mimi"); Cat pipi = new Cat("pipi"); mimi.info(); pipi.info(); } }
运行结果:
My name is mimi No.100
My name is pipi No.101
内存分析:
标签:mic 引用传递 color http static成员 使用 inf 分析 class
原文地址:https://www.cnblogs.com/nyist0/p/12364684.html