public class ClassInitTest {
private static int num = 1 ;
static {
num = 2 ;
number = 10 ;
}
private static int number = 1 ;
public static void main ( String [ ] args) {
System . out. println ( ClassInitTest . num) ;
}
}
public class HelloApp {
private static int a = 1 ;
public static void main ( String [ ] args) {
System . out. println ( a) ;
}
}
F:\20210526demo\src\jvm>javac StackStruTest. java
F:\20210526demo\src\jvm>javap - v StackStruTest. class
Classfile / F:/ 20210526demo/ src/ jvm/ StackStruTest. class
Last modified 2021- 9- 28; size 281 bytes
MD5 checksum 246097e2e82f3526bc9129f483fb1ce2
Compiled from "StackStruTest.java"
public class jvm. StackStruTest
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
{
public jvm. StackStruTest( ) ;
descriptor: ( ) V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial
4: return
LineNumberTable:
line 7: 0
public static void main( java. lang. String[ ] ) ;
descriptor: ( [ Ljava/ lang/ String; ) V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=2, args_size=1
0: iconst_5
1: istore_1
2: return
LineNumberTable:
line 9: 0
line 10: 2
}
SourceFile: "StackStruTest.java"
F:\20210526demo\src\jvm>javac StackStruTest. java
F:\20210526demo\src\jvm>javap - v StackStruTest. class
Classfile / F:/ 20210526demo/ src/ jvm/ StackStruTest. class
Last modified 2021- 9- 28; size 295 bytes
MD5 checksum 3e651d719afda20589b47cf33114caec
Compiled from "StackStruTest.java"
public class jvm. StackStruTest
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
{
public jvm. StackStruTest( ) ;
descriptor: ( ) V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial
4: return
LineNumberTable:
line 7: 0
public static void main( java. lang. String[ ] ) ;
descriptor: ( [ Ljava/ lang/ String; ) V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=4, args_size=1
0: iconst_2
1: istore_1
2: iconst_3
3: istore_2
4: iload_1
5: iload_2
6: iadd
7: istore_3
8: return
LineNumberTable:
line 10: 0
line 11: 2
line 12: 4
line 13: 8
}
SourceFile: "StackStruTest.java"
F:\20210526demo\src\jvm>jps
9664 AuthorityServerApplication
12804 RemoteMavenServer36
15364 OrderServerApplication
18380 MerchantServerApplication
3340 Launcher
16176 JUnitStarter
6320 FileServerApplication
27348 Launcher
5588
11128 GatewayServerApplication
15960 RemoteMavenServer36
22264 RemoteMavenServer36
3096 OauthServerApplication
5560 Launcher
9372 Jps
F:\20210526demo\src\jvm>jps
29344 StackStruTest
9664 AuthorityServerApplication
12804 RemoteMavenServer36
15364 OrderServerApplication
18380 MerchantServerApplication
16176 JUnitStarter
6320 FileServerApplication
27348 Launcher
5588
11128 GatewayServerApplication
15960 RemoteMavenServer36
22264 RemoteMavenServer36
3096 OauthServerApplication
31608 Jps
5560 Launcher
33340 Launcher
F:\20210526demo\src\jvm>jps
9664 AuthorityServerApplication
12804 RemoteMavenServer36
15364 OrderServerApplication
31012 Jps
18380 MerchantServerApplication
16176 JUnitStarter
6320 FileServerApplication
27348 Launcher
5588
11128 GatewayServerApplication
15960 RemoteMavenServer36
22264 RemoteMavenServer36
3096 OauthServerApplication
5560 Launcher
33340 Launcher
F:\20210526demo\src\jvm>javac HelloApp. java
F:\20210526demo\src\jvm>javap HelloApp. class
Compiled from "HelloApp.java"
public class jvm. HelloApp {
public jvm. HelloApp( ) ;
public static void main( java. lang. String[ ] ) ;
static { } ;
}
F:\20210526demo\src\jvm>javac ClassInitTest. java
F:\20210526demo\src\jvm>javac ClassInitTest. java
F:\20210526demo\src\jvm>javac ClassInitTest. java