public class Text {
public static void method1(){
System.out.println("method2 before");
method2();
System.out.println("method2 after");
}
public static void method2(){
System.out.println("method3 before");
method3();
System.out.println("method3 after");
}
public static void method3(){
System.out.println("exectute b");
}
public static void main(String[] args) {
method1();
}
}
---------------------------------------
输出结果为:
method2 before
method3 before
exectute b
method3 after
method2 after
public static void method1(){
System.out.println("method2 before");
method2();
System.out.println("method2 after");
}
public static void method2(){
System.out.println("method3 before");
method3();
System.out.println("method3 after");
}
public static void method3(){
System.out.println("exectute b");
}
public static void main(String[] args) {
method1();
}
}
---------------------------------------
输出结果为:
method2 before
method3 before
exectute b
method3 after
method2 after