class A { private String a = “aa”; //a在堆区 public boolean methodB() { String b = “bb”; //b在栈区 final String c = “cc”; // c在栈区 } }