1、for(;;)
@Test public void test(){ for(;;){ System.out.println("for"+"+++"); } }
编译后的字节码
public void test(); flags: ACC_PUBLIC Code: stack=2, locals=1, args_size=1 0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3 // String for+++ 5: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: goto 0 LineNumberTable: line 18: 0 LocalVariableTable: Start Length Slot Name Signature 0 11 0 this Lcom/jj/jingcai/MyTest; StackMapTable: number_of_entries = 1 frame_type = 0 /* same */ RuntimeVisibleAnnotations: 0: #17()
2、while(true)
@Test public void test(){ while (true){ System.out.println("while"+"---"); } }
编译后的字节码
public void test(); flags: ACC_PUBLIC Code: stack=2, locals=1, args_size=1 0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3 // String while--- 5: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: goto 0 LineNumberTable: line 18: 0 LocalVariableTable: Start Length Slot Name Signature 0 11 0 this Lcom/jj/jingcai/MyTest; StackMapTable: number_of_entries = 1 frame_type = 0 /* same */ RuntimeVisibleAnnotations: 0: #17()