JVM 之 Class文件

1.文件结构

  • 魔数
  • Class文件版本
  • 常量池
  • 访问标志
  • 类索引,父类索引,接口索引集合
  • 字段表集合
  • 方法表集合
  • 属性表集合
//文件格式:
ClassFile {
	u4 magic; // 魔法数字,表明当前文件是.class文件,固定0xCAFEBABE
	u2 minor_version; // 分别为Class文件的副版本和主版本
	u2 major_version;
	u2 constant_pool_count; // 常量池计数
	cp_info constant_pool[constant_pool_count-1]; //
	u2 access_flags; // 类访问标识
	u2 this_class; // 当前类
	u2 super_class; // 父类
	u2 interfaces_count; // 实现的接口数
	u2 interfaces[interfaces_count]; // 实现接口信息
	u2 fields_count; // 字段数量
	field_info fields[fields_count]; // 包含的字段信息
	u2 methods_count; // 方法数量
	method_info methods[methods_count]; // 包含的方法信息
	u2 attributes_count; // 属性数量
	attribute_info attributes[attributes_count]; // 各种属性
}

待补充。。。

具体参考官网:https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值