avatar

JVM的类加载过程(1)

当我们执行java命令的时候,java命令是怎么执行的呢。

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
package com.wzl.jvm.math;

/**
* @ClassName Math
* @Description Math
* @Author wuzhilang
* @Date 2020/8/15 18:36
* @Version 1.0
*/
public class Math {
public static final int initData = 666;
public static User user = new User();

public int compute() { //一个方法对应一块栈帧内存区域
int a = 1;
int b = 2;
int c = (a + b) * 10;
return c;
}

public static void main(String[] args) {
Math math = new Math();
math.compute();
}
}

这个类的JVM的执行图如下

文章作者: 无知的小狼
文章链接: https://bytedance.press/2020/08/15/20200801/JVM%E7%9A%84%E7%B1%BB%E5%8A%A0%E8%BD%BD%E6%9C%BA%E5%88%B6/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 无知的小狼

评论