首页 > 编程语言 > 详细

Java 字节码解读

时间:2020-12-11 22:44:18      阅读:42      评论:0      收藏:0      [点我收藏+]
  1. 源代码

  2. 反编译class 文件
  3.  

一、源代码

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"

三、利用Uedit 打开class 文件

 

Java 字节码解读

原文:https://www.cnblogs.com/baizhuang/p/14122533.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!