zoukankan      html  css  js  c++  java
  • 嵌套.

     第三章

    if基本语法:

    if(条件){// 表达式   // 代码块   }

    eg:    int a = 10;   

    if(a > 1){

     System.out.println("内容");   

    }

    if(){  

    // 代码块

    }else{

      // 代码块

    }

    eg: if(score >= 90){

     System.out.println("奖励Mp4一个");

    }else{  

    System.out.println("枪毙");

    }

    语法: if(条件){

        // 代码块

    }else if(条件){

        // 代码块

    }eles  if(条件){   

      // 代码块

    }

    .....{    

    // 代码块

    }else{    

    // 代码块

     }

    eg:

    if(score <= 30){   

       System.out.println("拉出去,枪毙");

      }else if(score <= 60){

         System.out.println("拉出去,坐牢20年");

      }else if(score <= 80){  

      System.out.println("找个对象");

      }else{   

       System.out.println("让对象给甩了!!!!");   }

    语法:

    if(条件){

      if(条件){   

       .....  

    }else if(条件){   

       .....   }else{      .......  

    } }else{   .......

    }

    eg:

    if(miao <= 10){

         System.out.println("请输入性别(男、女、变性人):");

     //char gender = input.next().charAt(0);

       String gender = input.next();

     if(gender.equals("男")){

          System.out.println("进入男子总决赛");

     }else if(gender.equals("女")){   

        System.out.println("进入女子总决赛");

     }else if(gender.equals("变性人")){

          System.out.println("进入变性人总决赛");  

    }else{   System.out.println("你不是人");

     }

    }else{  

           System.out.println("淘汰!!!"); }

  • 相关阅读:
    Learning to Compare: Relation Network for Few-Shot Learning 论文笔记
    修改python import模块中的变量
    roslaunch保存的log文件没有打印的ERROR信息
    python json demo
    vscode 1.32.x按下鼠标左键无法拖曳选择,而旧一点的版本1.30.2可以
    java-ee--------jdbc
    集合
    关键字
    java面向对象
    数组
  • 原文地址:https://www.cnblogs.com/aaaaliling/p/7535449.html
Copyright © 2011-2022 走看看