先运行一下演示程序。
public class MethodTestu08 {
public static void main(String[] args) {
System.out.println("main begin");
int x = 100;
m1(x);
System.out.println("main over");
}
public static void m1(int i) {
System.out.println("m1 begin");
m2(i);
System.out.println("m1 over");
}
public static void m2(int i) {
System.out.println("m2 begin");
m3(i);
System.out.println("m2 over");
}
public static void m3(int i) {
System.out.println("m3 begin");
System.out.println(i);
System.out.println("m3 over");
}
}
运行结果:
话不多说,直接上内存图。
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
综合上图: