当我们用java下令运行某个类的main函数启动程序时,首先必要通过类加载器把主类加载到 JVM
public class Math {
public static final int initData = 666;
public static User user = new User();
<span style="box-sizing: border-box;padding-right: 0.1px">
public int compute() { //一个方法对应一块栈帧内存区域
int a = 1;
int b = 2;
int c = (a + b) * 10;
return c;
}
<span style="box-sizing: border-box;padding-right: 0.1px">
public static void main(String[] args) {
Math math = new Math();
math.compute();
}
}通过Java下令执行代码的大体流程如下:
<span style="box-sizing: border-box"/>