Class文件结构
class文件是一组以8bit字节为基础单位的二进制流,各个数据项目严格按照顺序紧凑的排列在class文件中,中间没有添加任何分隔符。当遇到需要占用8bit字节以上的数据项时,会按照高位在前的方式分割成若干个8bit字节进行存储。 ClassFile结构 类型 名称 数量 u4 magic 1 u2 minor_version 1 u2 major_version 1 u2 constant_pool_count 1 cp_info constant_pool constant_pool_count-1 u2 access_flags 1 u2 this_class 1 u2 super_class 1 u2 interfaces_count 1 u2 interfaces interfaces_count u2 fields_count 1 field_info fields fields_count u2 methods_count 1 method_info methods methods_count u2 attributes_count 1 attribute_info attributes attributes_count MagicNumber 固定值: cafe babe 作用是确定这个文件是否为一个能被jvm所接受的Class文件