代码练习--if else


public class ifelse {
    public static void main(String[]  args){
    /**
     * 判断小明的期末成绩    
    int score = 90;
    if(score == 100)
    {
        System.out.println("奖励一辆BWM");
    }
    else if (score > 80 && score <=90) {
        System.out.println("一台iPhone5s");
    }
    else if (score >= 60 && score <= 80 ) {
        System.out.println("一本参考书");
    }
    else {
        System.out.println("Nothing");
    }
        */
    /*对下列代码,若有输出,指出输入结果*/
        int a = 4;
        int y = 1;
        if( a > 2){
            if(y > 2){
                System.out.println(a + y);
                System.out.println("atguigu");
            }
        }
        else {
            System.out.println("x is " + a);
        }
    }

}
 

猜你喜欢

转载自blog.csdn.net/weixin_42248871/article/details/109227321
今日推荐