class文件结构
package com.test.myMy; public class myJava{ public int a = 12; private int inc(){ return a+1; } }
C:\Users\mayn\Desktop>javac myJava.java
C:\Users\mayn\Desktop>javap -verbose myJava.class
得到内容与下:
Classfile /C:/Users/mayn/Desktop/myJava.class Last modified 2019-11-17; size 293 bytes MD5 checksum 913d2b031354314112f91ea4bcdbf712 Compiled from "myJava.java" public class com.test.myMy.myJava minor version: 0 major version: 52 flags: ACC_PUBLIC, ACC_SUPER Constant pool: #1 = Methodref #4.#15 // java/lang/Object."<init>":()V #2 = Fieldref #3.#16 // com/test/myMy/myJava.a:I #3 = Class #17 // com/test/myMy/myJava #4 = Class #18 // java/lang/Object #5 = Utf8 a #6 = Utf8 I #7 = Utf8 <init> #8 = Utf8 ()V #9 = Utf8 Code #10 = Utf8 LineNumberTable #11 = Utf8 inc #12 = Utf8 ()I #13 = Utf8 SourceFile #14 = Utf8 myJava.java #15 = NameAndType #7:#8 // "<init>":()V #16 = NameAndType #5:#6 // a:I #17 = Utf8 com/test/myMy/myJava #18 = Utf8 java/lang/Object { public int a; descriptor: I flags: ACC_PUBLIC public com.test.myMy.myJava(); descriptor: ()V flags: ACC_PUBLIC Code: stack=2, locals=1, args_size=1 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: aload_0 5: bipush 12 7: putfield #2 // Field a:I 10: return LineNumberTable: line 3: 0 line 4: 4 } SourceFile: "myJava.java"