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("淘汰!!!");
    }

  • 相关阅读:
    vue2.0是不支持通过下标来更改数组的,无法做到响应式
    C# 深拷贝 Bitmap对象示例
    vscode终端中文乱码
    TkbmMemTable使用总结
    openssl 证书概念介绍
    openssl源码介绍
    python变量赋值特性
    openssl安装
    github开源协议选择
    NLP 多分类神经网络
  • 原文地址:https://www.cnblogs.com/SFHa/p/7535419.html
Copyright © 2011-2022 走看看