当前位置:网站首页>类的加载与ClassLoader的理解
类的加载与ClassLoader的理解
2022-04-23 05:41:00 【hanyc..】


1、加载:将类的class字节码文件加载到内存中,并把静态数据转换成方法区(特殊的堆)的运行时数据结构。在此阶段,生成代表这个类的java.lang.Class对象。
2、链接:将Java类的二进制数据合并到JRE中
- 验证:确保加载的类类信息符合JVM规范,没有安全方面的问题;
- 准备:正式为类变量(static)分配内存,并设置类变量默认初始值,这些内存都是在方法区中进行分配;
- 解析:将JVM常量池中的符号引用(常量名)替换为直接引用(地址)。
3、初始化:
- 执行由类的static(静态代码块、静态变量)合并而成的一个类构造器()。(这里的这个类构造器是构造类信息类的,不是构造类对象的构造器)
- 如果初始化一个类的时候,发现他的父类还没有初始化,那么会先去初始化它的父类。
- JVM保证一个类的()方法在多线程环境中被正确加锁和同步。
(重点记住加粗字体部分)
版权声明
本文为[hanyc..]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_42732184/article/details/124306745
边栏推荐
- Isosceles triangle - the 9th Lanqiao provincial competition - group C
- STL function library
- freemark中插入图片
- JS number capitalization method
- Jiugong magic square - the 8th Lanqiao provincial competition - group C (DFS and comparison of all magic square types)
- 第36期《AtCoder Beginner Contest 248 打比赛总结》
- Excel sets row and column colors according to cell contents
- C语言——恶搞关机小程序
- POI exports to excel, and the same row of data is automatically merged into cells
- 多个一维数组拆分合并为二维数组
猜你喜欢
随机推荐
Xiuxian real world and game world
mysql-触发器、存储过程、存储函数
Breadth first search topics (BFS)
JVM系列(4)——内存溢出(OOM)
2 - software design principles
Golang implements Ping connectivity detection case through exec module
Cmake basic tutorial (39) pkgconfig
POI exports to excel, and the same row of data is automatically merged into cells
Insert picture in freemark
windows连接mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)
Hotkeys, interface visualization configuration (interface interaction)
Split and merge multiple one-dimensional arrays into two-dimensional arrays
Duplicate key update in MySQL
JVM系列(3)——内存分配与回收策略
Dwsurvey is an open source questionnaire system. Solve the problem that cannot be run and modify the bug.
踩坑:nacos利用startup.cmd -m standalone启动错误
Common protocols of OSI layer
The list attribute in the entity is empty or null, and is set to an empty array
refused connection
框架解析1.系统架构简介









