(二十三)控制转移指令

一、概念

 二、案例

  • 源代码

public class Test {

    public static void main(String []args){
        
        int age = 10;
        
        if( age > 10 ){
            System.out.println("  > 10");
        }else{
            System.out.println(" < = 10");
        }
        
        String userName = "admin";
    }
}
  • javap -verbose Test.class 解析如下,当程序运行到if语句时,执行if_icmple指令,判断(age>10)是否成立,如果成立则继续执行,如果不成立则跳转到20行继续执行,即跳转到getstatic指令。

 

原文地址:https://www.cnblogs.com/shyroke/p/9160721.html