public class HelloStart { public void start(); Code: 0: getstatic #12 // Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #14 // String Hey I am non-static 'start' method 5: invokevirtual #19 // Method "Ljava/io/PrintStream;".println:(Ljava/lang/String;)V 8: return
//Constructor public HelloStart(); Code: 0: aload_0 //get "this" 1: invokespecial #22 // Method java/lang/Object."<init>":()V - call super 4: return
public static void main(java.lang.String[]); Code: 0: new #2 // class HelloStart - create new object 3: dup //duplicate new object so that invokespecial does not consumes it 4: invokespecial #25 // Method "<init>":()V - call constructor 7: invokevirtual #27 // Method start:()V 10: return }
与之对应 Java 类如下:
1 2 3 4 5 6 7 8 9 10 11 12 13
public class HelloStart { public HelloStart() { }
public static void main(String[] var0) { (new HelloStart()).start(); } public void start() { System.out.println("Hey I am non-static \'start\' method"); }