Java 位元組碼解讀
阿新 • • 發佈:2020-12-12
-
原始碼
- 反編譯class 檔案
一、原始碼
public class People { private String name; private int age; }
二、利用Javap 反編譯檢視位元組碼結構資訊
javap -v People.class
結果如下
Classfile /D:/work/byte-code/src/People.class Last modified 2020-12-9; size 240 bytes MD5 checksum 54b8c1ad94a9c9cf5074fd8520454e9c Compiled from"People.java" public class People minor version: 0 major version: 52 flags: ACC_PUBLIC, ACC_SUPER Constant pool: #1 = Methodref #3.#14 // java/lang/Object."<init>":()V #2 = Class #15 // People #3 = Class #16 // java/lang/Object#4 = Utf8 name #5 = Utf8 Ljava/lang/String; #6 = Utf8 age #7 = Utf8 I #8 = Utf8 <init> #9 = Utf8 ()V #10 = Utf8 Code #11 = Utf8 LineNumberTable #12 = Utf8 SourceFile #13 = Utf8 People.java #14 = NameAndType #8:#9 // "<init>":()V #15 = Utf8 People #16 = Utf8 java/lang/Object { public People(); descriptor: ()V flags: ACC_PUBLIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return LineNumberTable: line 5: 0 } SourceFile: "People.java"