Thursday, March 20, 2008

Demonstration

As an example consider the following Java source file.


public class Hello {
public static void main(String [] args) {
System.out.println("Hello World");
}
}




The ByteML corresponding to the class file , Hello.xml, looks as follows.













































































































The java disassembly code (from the 'javap' utility) is shown as follows.


$ javap -c Hello
Compiled from "Hello.java"
public class Hello extends java.lang.Object{
public Hello();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return

public static void main(java.lang.String[]);
Code:
0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #3; //String Hello World
5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: return

}