1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class Test {
public static void main(String[] args) {
methodA();
}
public static void methodA() {
methodB();
}
public static void methodB() {
methodC();
}
public static void methodC() {
//
}
}
栈特点:先进后出
启动:main -> methodA -> methodB -> methodC
退出:methodC -> methodB -> methodA -> main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Classfile /Users/baoguo/codes/demo3/Test.class
Last modified Mar 25, 2022; size 451 bytes
MD5 checksum 82ebbb2b39b5fe233c861af30de4a984
Compiled from "Test.java"
public class Test
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #6.#18 // java/lang/Object."<init>":()V
#2 = Methodref #5.#19 // Test.methodA:()V
#3 = Methodref #5.#20 // Test.methodB:()V
#4 = Methodref #5.#21 // Test.methodC:()V
#5 = Class #22 // Test
#6 = Class #23 // java/lang/Object
#7 = Utf8 <init>
#8 = Utf8 ()V
#9 = Utf8 Code
#10 = Utf8 LineNumberTable
#11 = Utf8 main
#12 = Utf8 ([Ljava/lang/String;)V
#13 = Utf8 methodA
#14 = Utf8 methodB
#15 = Utf8 methodC
#16 = Utf8 SourceFile
#17 = Utf8 Test.java
#18 = NameAndType #7:#8 // "<init>":()V
#19 = NameAndType #13:#8 // methodA:()V
#20 = NameAndType #14:#8 // methodB:()V
#21 = NameAndType #15:#8 // methodC:()V
#22 = Utf8 Test
#23 = Utf8 java/lang/Object
{
public Test();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 1: 0
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=1, args_size=1
0: invokestatic #2 // Method methodA:()V
3: return
LineNumberTable:
line 3: 0
line 4: 3
public static void methodA();
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=0, args_size=0
0: invokestatic #3 // Method methodB:()V
3: return
LineNumberTable:
line 7: 0
line 8: 3
public static void methodB();
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=0, args_size=0
0: invokestatic #4 // Method methodC:()V
3: return
LineNumberTable:
line 11: 0
line 12: 3
public static void methodC();
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=0, args_size=0
0: return
LineNumberTable:
line 16: 0
}
SourceFile: "Test.java"