Home
>
Archives
>
JVM try-catch
JVM try-catch
Publish:
1
2
3
4
5
6
7
8
9
10
| public class Test {
public static void main(String[] args) {
int x = 100;
try {
x = 200;
}catch (Exception e) {
x = 300;
}
}
}
|
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
88
89
90
91
92
93
94
95
96
97
| /Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home\bin\javap -v Test
Classfile /Users/baoguo/codes/demo/target/classes/Test.class
Last modified Mar 27, 2022; size 554 bytes
MD5 checksum c1a74c8c5594a133fe260938831ad297
Compiled from "Test.java"
public class Test
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #4.#26 // java/lang/Object."<init>":()V
#2 = Class #27 // java/lang/Exception
#3 = Class #28 // Test
#4 = Class #29 // java/lang/Object
#5 = Utf8 <init>
#6 = Utf8 ()V
#7 = Utf8 Code
#8 = Utf8 LineNumberTable
#9 = Utf8 LocalVariableTable
#10 = Utf8 this
#11 = Utf8 LTest;
#12 = Utf8 main
#13 = Utf8 ([Ljava/lang/String;)V
#14 = Utf8 e
#15 = Utf8 Ljava/lang/Exception;
#16 = Utf8 args
#17 = Utf8 [Ljava/lang/String;
#18 = Utf8 x
#19 = Utf8 I
#20 = Utf8 StackMapTable
#21 = Class #17 // "[Ljava/lang/String;"
#22 = Class #27 // java/lang/Exception
#23 = Utf8 MethodParameters
#24 = Utf8 SourceFile
#25 = Utf8 Test.java
#26 = NameAndType #5:#6 // "<init>":()V
#27 = Utf8 java/lang/Exception
#28 = Utf8 Test
#29 = 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
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this LTest;
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=3, args_size=1
0: bipush 100
2: istore_1
3: sipush 200
6: istore_1
7: goto 15
10: astore_2
11: sipush 300
14: istore_1
15: return
Exception table:
from to target type
3 7 10 Class java/lang/Exception
LineNumberTable:
line 3: 0
line 5: 3
line 8: 7
line 6: 10
line 7: 11
line 9: 15
LocalVariableTable:
Start Length Slot Name Signature
11 4 2 e Ljava/lang/Exception;
0 16 0 args [Ljava/lang/String;
3 13 1 x I
StackMapTable: number_of_entries = 2
frame_type = 255 /* full_frame */
offset_delta = 10
locals = [ class "[Ljava/lang/String;", int ]
stack = [ class java/lang/Exception ]
frame_type = 4 /* same */
MethodParameters:
Name Flags
args
}
SourceFile: "Test.java"
Process finished with exit code 0
|
声明: 本文采用 BY-NC-SA 授权。转载请注明转自: Ding Bao Guo