package Demo;

public class BirthDate {
private int day;
private int month;
private int year; public BirthDate(int d, int m, int y) {
day = d;
month = m;
year = y;
}
}

java bean

package Demo;

public class Demo {
public static void main(String[] args) {
BirthDate d1 = new BirthDate(7, 7, 1970);
}
}

测试类

内存分析图:

java 内存分析之构造方法执行过程-LMLPHP

05-11 22:00