(二十三)控制转移指令

Posted shyroke

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(二十三)控制转移指令相关的知识,希望对你有一定的参考价值。

一、概念

技术分享图片

技术分享图片

 

 二、案例

  • 源代码

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指令。

 技术分享图片

 

以上是关于(二十三)控制转移指令的主要内容,如果未能解决你的问题,请参考以下文章