反编译字节码文件

Hello.java

public class Hello {
    public static void main(String[] args) {
        short s = 0;
        s += 1;
        System.out.println(s);
    }
}

编译

javac Hello.java

然后会在当前路径下生成字节码文件 Hello.class
反编译该字节码文件

javap -c verbose Hello.class

public class com.moyu.Hello {
  public com.moyu.Hello();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V
       4: return

  public static void main(java.lang.String[]);
    Code:
       0: iconst_0
       1: istore_1
       2: iload_1
       3: iconst_1
       4: iadd
       5: i2s
       6: istore_1
       7: getstatic     #2                  // Field java/lang/System.out:Ljava/io/PrintStream;
      10: iload_1
      11: invokevirtual #3                  // Method java/io/PrintStream.println:(I)V
      14: return
}
posted @ 2022-10-16 20:57  OraCat  阅读(19)  评论(0编辑  收藏  举报