Java class file format spec link:https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html
Here are an example:
-----------------------------------------------------Java source File---------------------------------------------------------
public class Main {
public static void Main (string[] args) {
System.out.println ("Hello");
}
}
-----------------------------------------------------Java class File----------------------------------------------------------
0000000:cafe babe 0000 0033 001d 0a00 0600 0f09 .... 3 .....
0000010:0010 0011 0800 120a 0013 0014 0700 1507 ........
0000020:0016 0100 063c 696e 6974 3e01 0003 2829 ..... <init> ()
0000030:5601 0004 436f 6465 0100 0f4c 696e 654e V ... Code ... Linen
0000040:756d 6265 7254 6162 6c65 0100 046d 6169 Umbertable...mai
0000050:6E01 0016 285b 4c6a 6176 612f 6c61 6e67 n ... ([Ljava/lang
0000060:2f53 7472 696e 673b 2956 0100 0a53 6f75/string;) V ... Sou
0000070:7263 6546 696c 6501 0009 4d61 696e 2e6a rcefile ... Main.j
0000080:6176 610c 0007 0008 0700 170c 0018 0019 Ava ......
0000090:0100 0568 656c 6c6f 0700 1a0c 001b 001c ... hello .....
00000a0:0100 044d 6169 6e01 0010 6a61 7661 2f6c ... main...java/l
00000b0:616e 672f 4f62 6a65 6374 0100 106a 6176 Ang/object...jav
00000c0:612f 6c61 6e67 2f53 7973 7465 6d01 0003 a/lang/system ...
00000d0:6f75 7401 0015 4c6a 6176 612f 696f 2f50 out ... ljava/io/p
00000e0:7269 6e74 5374 7265 616d 3b01 0013 6a61 Rintstream;...ja
00000f0:7661 2f69 6f2f 5072 696e 7453 7472 6561 Va/io/printstrea
0000100:6D01 0007 7072 696e 746c 6e01 0015 284c m...println ... (L
0000110:6a61 7661 2f6c 616e 672f 5374 7269 6e67 java/lang/string
0000120:3b29 5600 2100 0500 b:0000 0000 XX 0200;) v.! ...........
0000130:0100 0700 0800 0100 0900 0000 1d00 0100 ........
0000140:0100 0000 052a b700 01b1 0000 0001 000a ........
0000150:0000 0006 0001 0000 0002 0009 000b 000c ..... .....
0000160:0001 0009 0000 0025 0002 0001 0000 0009 ..... .....
0000170:b200 0212 03b6 0004 b100 0000 0100 0a00 ........
0000180:0000 0a00 0200 0000 0400 0800 05 00 0100 ........
0000190:0d00 0000 0200 0e .....
---------------------------------------------------Java class file Parse--------------------------------------------------------
Magic number: {CA FE BA be}
Minor_version: {00 00}
Major_version: {00 33}
Constant_pool_count: {1d} (28)
CONSTANT_POOL[01]: {0a 0006 000f}--> constant_methodref_info
CONSTANT_POOL[02]: {0010 0011}--Constant_fieldref_info
CONSTANT_POOL[03]: {0012}--Constant_string_info
CONSTANT_POOL[04]: {0a 0013 0014}--Constant_methodref_info
CONSTANT_POOL[05]: {0015}-Constant_class_info
CONSTANT_POOL[06]: {0016}-Constant_class_info
CONSTANT_POOL[07]: {0006}--{3c 6e 3e}--"<init>"-constant_utf8_info
CONSTANT_POOL[08]: {0003}--{28 56}--"() V"--Constant_utf8_info
CONSTANT_POOL[09]: {0004}--{43 6f 65}--"Code"--Constant_utf8_info
CONSTANT_POOL[10]: {000f}--{4c 6e 4e (6d)------------------"linenumbertable"--Constant_utf 8_info
CONSTANT_POOL[11]: {0004}--{6d 6e}--"main"--constant_utf8_info
CONSTANT_POOL[12]: {0016}--{285b4c6a6176612f 6c61 6e67 2f53 7472 696e 673b 2956}--"([ljava/lang/string;) V"-->cons Tant_utf8_info
CONSTANT_POOL[13]: {000a}--{53 6f757263 6546 696c)--"sourcefile"--Constant_utf8_info
CONSTANT_POOL[14]: {0009}--{4d61 696e 2e6a 6176)--"Main.java"--Constant_utf8_info
CONSTANT_POOL[15]: {0c 0007 0008}--> {<init> () V}--Constant_nameandtype_info
CONSTANT_POOL[16]: {0017}--Constant_class_info
CONSTANT_POOL[17]: {0c 0018 0019} constant_nameandtype_info
CONSTANT_POOL[18]: {0005}--{656c 6c6f} "Hello"--Constant_utf8_info
CONSTANT_POOL[19]: {001a}-Constant_class_info
CONSTANT_POOL[20]: {0c 001b 001c}--Constant_nameandtype_info
CONSTANT_POOL[21]: {0004}--{4d 6169 6e}---"Main"--Constant_utf8_info
CONSTANT_POOL[22]: {0010} and {6a61 7661 2f6c 616e 672f 4f62 6a65 6374}--"Java/lang/object"-->constant_utf8_inf O
CONSTANT_POOL[23]: {0010} and {6a 6176612f 6c61 6e67 2f53 7973 7465 6d}--"Java/lang/system"-->constant_utf8_inf O
CONSTANT_POOL[24]: {0003}--{6f] 74}--"out" and Constant_utf8_info
CONSTANT_POOL[25]: {0015} and {4c6a 6176 612f 696f 2f507269 6e74 5374 7265 616d 3b}--"ljava/io/printstream;" -->constant_utf8_info
CONSTANT_POOL[26]: {0013} and {6a617661 2f69 6f2f 5072 696e 7453 7472 65616d}--"Java/io/printstream"--Consta Nt_utf8_info
CONSTANT_POOL[27]: {0007} and {7072 696e 746c 6e}--"println"-->constant_utf8_info
CONSTANT_POOL[28]: {0015} and {284c 6a61 7661 2f6c 616e 672f 5374 7269 6e67 3b29--"(ljava/lang/string;) V"
Access_flag: {~ ~ ~ ~ ~ +}--{acc_public | Acc_super}
This_class: {XX}--"Main"
Super_class: {0006}--"Java/lang/object"
Interface_count: {xx}-0
Field_count: {xx}-0
Methods_count: {00 02:2}
Methods[1]: {0001:acc_public, XX: "<init>", XX: "() V", xx 01:1, attributes[1]{00 09:code, xx 0000 1d:29, I Nfo:{next Line}}}
code{00 0100 0000 052a b700 01b1 0000 0001 000a 0000 0006 0001 0000 0002}
Methods[2]: {0009:acc_public | Acc_static, 000b, 0b: "Main", 000c: ([ljava/lang/string;) V, 0001:1, attributes[1]{0009:code, 0000 0025:37}}
code{0002 0001 0000 0009 b200 0212 03b6 0004 b100 0000 0100 0a00 0000 0a00 02 0200 0000 0400 0800 05}
attributes_count:{00 01}
attributes[1]:{00, 0d:sourcefile, xx 02:2, xx 0e: "Main.java"}
--------------------------------------------------------------------------------------------------------------- ----------------
Java class file Format specfication