0x00 字节码是什么鬼
java前端编译器生成的文件,可以在jvm运行。
0x00 写了什么
总体格式
|
Class File format |
||
| type | descriptor | remark |
| u4 | magic | 0xCAFEBABE |
| u2 | minor_version | |
| u2 | major_version | |
| u2 | constant_pool_count | |
| cp_info | constant_pool[cosntant_pool_count – 1] | index 0 is invalid |
| 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://my.oschina.net/indestiny/blog/194260
http://www.blogjava.net/DLevin/archive/2011/09/05/358033.html
测试代码:
package test;
public class Test {
public static void main(String[] args) {
int a =1;
System.out.println(a);
}
}
javac 编译后的字节码:
