java 内存分析之this

package Demo;
/**
 * this 的值是当前对象的引用
 * @author Aaron
 *
 */
public class Boy {
    private int age;
    public Boy(int age) {
        this.age = age;
    }
    public Boy work() {
        this.sayHi();
        return this;
    }
    public void sayHi() {
        System.out.println("中华人民共和国");
    }
    public static void main(String[] args) {
        new Boy(20).work();
    }
}
源码

内存分析:

原文地址:https://www.cnblogs.com/Mike_Chang/p/7004371.html