javap是JDK自帶的反匯編器
語法
javap [ 命令選項 ] class
javap 命令用於解析類文件
命令選項
t
實例
Hello
public class Hello
{
static void main(String args[])
{
int i=
int j=
int m=i+j;
System
}
int get()
{
int a=
int b=
int c=
int d=
int e=
int f=
int n=a+b+c+d+e+f;
return n;
}
static int get
{
int a=
int b=
int c=
int d=a+b;
return d;
}
}
然後再執行以下命令
javac Hello
javap
得到
Compiled from
public class Hello extends java
public Hello();
Code:
aload_
invokespecial #
return
static void main(java
Code:
bipush
istore_
bipush
istore_
iload_
iload_
iadd
istore_
getstatic #
new #
dup
invokespecial #
ldc #
invokevirtual #
iload_
invokevirtual #
invokevirtual #
invokevirtual #
return
int get();
Code:
iconst_
istore_
iconst_
istore_
iconst_
istore_
iconst_
istore
iconst_
istore
bipush
istore
iload_
iload_
iadd
iload_
iadd
iload
iadd
iload
iadd
iload
iadd
istore
iload
ireturn
static int get
Code:
iconst_
istore_
bipush
istore_
bipush
istore_
iload_
iload_
iadd
istore_
iload_
ireturn
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/27151.html