1. 程式人生 > >Java Class檔案的一些解讀

Java Class檔案的一些解讀

E:\program\JVM\bin\com\gissky\clazz>javap -v Sub.class
Classfile /E:/program/JVM/bin/com/gissky/clazz/Sub.class
  Last modified 2015-2-22; size 1363 bytes
  MD5 checksum 2dc77c79e4790422407eb7092085883c
  Compiled from "Sub.java"
public class com.gissky.clazz.Sub extends com.gissky.clazz.Base implements com.gissky.clazz.InterB,com.gissky.clazz.InterC
  SourceFile: "Sub.java"
  minor version: 0
  major version: 51
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
   #1 = Class              #2             //  com/gissky/clazz/Sub    →類和介面的全限定名    
   #2 = Utf8               com/gissky/clazz/Sub
   #3 = Class              #4             //  com/gissky/clazz/Base
   #4 = Utf8               com/gissky/clazz/Base
   #5 = Class              #6             //  com/gissky/clazz/InterB
   #6 = Utf8               com/gissky/clazz/InterB
   #7 = Class              #8             //  com/gissky/clazz/InterC
   #8 = Utf8               com/gissky/clazz/InterC
   #9 = Utf8               subInt 
  #10 = Utf8              I 
  #11 = Utf8              subString
  #12 = Utf8               Ljava/lang/String;
  #13 = Utf8               subObject
  #14 = Utf8               Ljava/lang/Object;
  #15 = Utf8               <init>
  #16 = Utf8               ()V
  #17 = Utf8               Code
  #18 = Methodref          #3.#19         //  com/gissky/clazz/Base."<init>":()V
  #19 = NameAndType        #15:#16        //  "<init>":()V
  #20 = Utf8               LineNumberTable
  #21 = Utf8               LocalVariableTable
  #22 = Utf8               this
  #23 = Utf8               Lcom/gissky/clazz/Sub;
  #24 = Utf8               getSubInt
  #25 = Utf8               ()I 
  #26 = Fieldref           #1.#27         //  com/gissky/clazz/Sub.subInt:I         → 類中欄位的符號引用
  #27 = NameAndType        #9:#10         //  subInt:I                                           → 類中欄位的部分符號引用之名稱和型別
  #28 = Utf8               setSubInt
  #29 = Utf8               (I)V
  #30 = Utf8               getSubString
  #31 = Utf8               ()Ljava/lang/String;
  #32 = Fieldref           #1.#33         //  com/gissky/clazz/Sub.subString:Ljava/lang/String;
  #33 = NameAndType        #11:#12        //  subString:Ljava/lang/String;
  #34 = Utf8               setSubString
  #35 = Utf8               (Ljava/lang/String;)V
  #36 = Utf8               getSubObject
  #37 = Utf8               ()Ljava/lang/Object;
  #38 = Fieldref           #1.#39         //  com/gissky/clazz/Sub.subObject:Ljava/lang/Object;
  #39 = NameAndType        #13:#14        //  subObject:Ljava/lang/Object;
  #40 = Utf8               setSubObject
  #41 = Utf8               (Ljava/lang/Object;)V
  #42 = Utf8               interC
  #43 = Fieldref           #44.#46        //  java/lang/System.out:Ljava/io/PrintStream;
  #44 = Class              #45            //  java/lang/System
  #45 = Utf8               java/lang/System
  #46 = NameAndType        #47:#48        //  out:Ljava/io/PrintStream;
  #47 = Utf8               out
  #48 = Utf8               Ljava/io/PrintStream;
  #49 = String             #50            //  the interC in Sub
  #50 = Utf8               the interC in Sub
  #51 = Methodref          #52.#54        //  java/io/PrintStream.println:(Ljava/lang/String;)V
  #52 = Class              #53            //  java/io/PrintStream
  #53 = Utf8               java/io/PrintStream
  #54 = NameAndType        #55:#35        //  println:(Ljava/lang/String;)V
  #55 = Utf8               println
  #56 = Utf8               interB
  #57 = Utf8               (I)Ljava/lang/String;
  #58 = String             #59            //  the interB in Sub                                    →方法中用到的String常量
  #59 = Utf8               the interB in Sub
  #60 = Utf8               i
  #61 = Utf8               SourceFile
  #62 = Utf8               Sub.java