原Java文件如:
public class Hello{
public static void main(String args[])
{
int a=0;
a+=1;
}
}
用javac将其编译,然后使用javap -c -v Hello反编译得到如下结果:
Compiled from "Hello.java"
public class Hello extends java.lang.Object
SourceFile: "Hello.java"
minor version: 0
major version: 50
Constant pool:
const #1 = Method #3.#12; // java/lang/Object."<init>":()V
const #2 = class #13; // Hello
const #3 = class #14; // java/lang/Object
const #4 = Asciz <init>;
const #5 = Asciz ()V;
const #6 = Asciz Code;
const #7 = Asciz LineNumberTable;
const #8 = Asciz main;
const #9 = Asciz ([Ljava/lang/String;)V;
const #10 = Asciz SourceFile;
const #11 = Asciz Hello.java;
const #12 = NameAndType #4:#5;// "<init>":()V
const #13 = Asciz Hello;
const #14 = Asciz java/lang/Object;
{
public Hello();
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 1: 0
public static void main(java.lang.String[]);
Code:
Stack=1, Locals=2, Args_size=1
0: iconst_0
1: istore_1
2: iinc 1, 1
5: return
LineNumberTable:
line 4: 0
line 5: 2
line 7: 5
}