问二:你了解JAVA的内存模型(JMM)吗?
原理图:
注:java8中,已经将常量池移动到堆中
部件详解:
举例:执行add(1,2)
Method area is created on virtual machine startup, shared among all Java virtual machine threads and it is logically part of heap area. It stores per-class structures such as the run-time constant pool, field and method data, and the code for methods and constructors.