Java代码
\A.java
public class A{}
- 1
- 2
- 1
- 2
javac A.java \得到 A.class
javap -v A.class
下面是javap工具帮我们生成的文本的字节码文件
Classfile /home/yao/test/javap/A.class
Last modified Aug 30, 2016; size 176 bytes
MD5 checksum f35fe1f44d02cd491e6561a30327ceb5
Compiled from "A.java"
public class A
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #3.#10 // java/lang/Object."<init>":()V
#2 = Class #11 // A
#3 = Class #12 // java/lang/Object
#4 = Utf8 <init>
#5 = Utf8 ()V
#6 = Utf8 Code
#7 = Utf8 LineNumberTable
#8 = Utf8 SourceFile
#9 = Utf8 A.java
#10 = NameAndType #4:#5 // "<init>":()V
#11 = Utf8 A
#12 = Utf8 java/lang/Object
{
public A();
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 1: 0
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
不过瘾?自己按照java规范翻译一遍~
\通过linux hexdump -C A.class 可以以16进制方式查看文件
00000000 ca fe ba be 00 00 00 34 00 0d 0a 00 03 00 0a 07 |.......4........|
00000010 00 0b 07 00 0c 01 00 06 3c 69 6e 69 74 3e 01 00 |........<init>..|
00000020 03 28 29 56 01 00 04 43 6f 64 65 01 00 0f 4c 69 |.()V...Code...Li|
00000030 6e 65 4e 75 6d 62 65 72 54 61 62 6c 65 01 00 0a |neNumberTable...|
00000040 53 6f 75 72 63 65 46 69 6c 65 01 00 06 41 2e 6a |SourceFile...A.j|
00000050 61 76 61 0c 00 04 00 05 01 00 01 41 01 00 10 6a |ava........A...j|
00000060 61 76 61 2f 6c 61 6e 67 2f 4f 62 6a 65 63 74 00 |ava/lang/Object.|
00000070 21 00 02 00 03 00 00 00 00 00 01 00 01 00 04 00 |!...............|
00000080 05 00 01 00 06 00 00 00 1d 00 01 00 01 00 00 00 |................|
00000090 05 2a b7 00 01 b1 00 00 00 01 00 07 00 00 00 06 |.*..............|
000000a0 00 01 00 00 00 01 00 01 00 08 00 00 00 02 00 09