Note it begins with CAFEBABE (class files always do) and the translation of some of the obscure bits (eg what the Strings are) is shown. You can look up in the meanings of all the numbers in this part of the JVM specification.[Campbell@dhcppc0 disk]$ hexedit HelloWorld.class
00000000 CA FE BA BE 00 00 00 2E 00 19 07 00 02 01 00 0A ................
00000010 48 65 6C 6C 6F 57 6F 72 6C 64 07 00 04 01 00 10 HelloWorld......
00000020 6A 61 76 61 2F 6C 61 6E 67 2F 4F 62 6A 65 63 74 java/lang/Object
00000030 01 00 06 3C 69 6E 69 74 3E 01 00 03 28 29 56 01 ...<init>...()V.
00000040 00 04 43 6F 64 65 0A 00 03 00 09 0C 00 05 00 06 ..Code..........
00000050 01 00 0F 4C 69 6E 65 4E 75 6D 62 65 72 54 61 62 ...LineNumberTab
00000060 6C 65 01 00 04 6D 61 69 6E 01 00 16 28 5B 4C 6A le...main...([Lj
00000070 61 76 61 2F 6C 61 6E 67 2F 53 74 72 69 6E 67 3B ava/lang/String;
00000080 29 56 08 00 0E 01 00 0C 48 65 6C 6C 6F 20 57 6F )V......Hello Wo
00000090 72 6C 64 21 08 00 10 01 00 07 53 75 63 63 65 73 rld!......Succes
000000A0 73 0A 00 12 00 14 07 00 13 01 00 17 6A 61 76 61 s...........java
000000B0 78 2F 73 77 69 6E 67 2F 4A 4F 70 74 69 6F 6E 50 x/swing/JOptionP
000000C0 61 6E 65 0C 00 15 00 16 01 00 11 73 68 6F 77 4D ane........showM
000000D0 65 73 73 61 67 65 44 69 61 6C 6F 67 01 00 3C 28 essageDialog..<(
000000E0 4C 6A 61 76 61 2F 61 77 74 2F 43 6F 6D 70 6F 6E Ljava/awt/Compon
000000F0 65 6E 74 3B 4C 6A 61 76 61 2F 6C 61 6E 67 2F 4F ent;Ljava/lang/O
00000100 62 6A 65 63 74 3B 4C 6A 61 76 61 2F 6C 61 6E 67 bject;Ljava/lang
00000110 2F 53 74 72 69 6E 67 3B 49 29 56 01 00 0A 53 6F /String;I)V...So
00000120 75 72 63 65 46 69 6C 65 01 00 0F 48 65 6C 6C 6F urceFile...Hello
00000130 57 6F 72 6C 64 2E 6A 61 76 61 00 21 00 01 00 03 World.java.!....
00000140 00 00 00 00 00 02 00 01 00 05 00 06 00 01 00 07 ................
00000150 00 00 00 1D 00 01 00 01 00 00 00 05 2A B7 00 08 ............*...
00000160 B1 00 00 00 01 00 0A 00 00 00 06 00 01 00 00 00 ................
00000170 03 00 09 00 0B 00 0C 00 01 00 07 00 00 00 32 00 ..............2.
00000180 04 00 01 00 00 00 0A 01 12 0D 12 0F 04 B8 00 11 ................
00000190 B1 00 00 00 01 00 0A 00 00 00 16 00 05 00 00 00 ................
000001A0 07 00 01 00 08 00 05 00 09 00 06 00 07 00 09 00 ................
000001B0 0A 00 01 00 17 00 00 00 02 00 18 ...........
--- HelloWorld.class --0x0/0x1BB----------------------------------------
or with the -c flag, this:-[Campbell@dhcppc0 disk]$ /usr/java/jdk1.6.0/bin/javap HelloWorld
Compiled from "HelloWorld.java"
public class HelloWorld extends java.lang.Object{
public HelloWorld();
public static void main(java.lang.String[]);
}
You can see that the JVM uses something which is not machine code to run with. That is why you call it an interpreted language.[Campbell@dhcppc0 disk]$ /usr/java/jdk1.6.0/bin/javap -c HelloWorld
Compiled from "HelloWorld.java"
public class HelloWorld extends java.lang.Object{
public HelloWorld();
Code:
0: aload_0
1: invokespecial #8; //Method java/lang/Object."<init>" )V
4: return
public static void main(java.lang.String[]);
Code:
0: aconst_null
1: ldc #13; //String Hello World!
3: ldc #15; //String Success
5: iconst_1
6: invokestatic #17; //Method javax/swing/JOptionPane.showMessageDialog Ljava/awt/Component;Ljava/lang/Object;Ljava/lang/String;I)V
9: return
}
Interpreted languages. You write y = x + 1 and the compiler produces and executes the machine code.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|