zoukankan      html  css  js  c++  java
  • 吴裕雄--天生自然 JAVA开发学习:条件语句

    public class Test {
     
       public static void main(String args[]){
          int x = 10;
     
          if( x < 20 ){
             System.out.print("这是 if 语句");
          }
       }
    }
    if(布尔表达式){
       //如果布尔表达式的值为true
    }else{
       //如果布尔表达式的值为false
    }
    public class Test {
     
       public static void main(String args[]){
          int x = 30;
     
          if( x < 20 ){
             System.out.print("这是 if 语句");
          }else{
             System.out.print("这是 else 语句");
          }
       }
    }
    if(布尔表达式 1){
       //如果布尔表达式 1的值为true执行代码
    }else if(布尔表达式 2){
       //如果布尔表达式 2的值为true执行代码
    }else if(布尔表达式 3){
       //如果布尔表达式 3的值为true执行代码
    }else {
       //如果以上布尔表达式都不为true执行代码
    }
    public class Test {
       public static void main(String args[]){
          int x = 30;
     
          if( x == 10 ){
             System.out.print("Value of X is 10");
          }else if( x == 20 ){
             System.out.print("Value of X is 20");
          }else if( x == 30 ){
             System.out.print("Value of X is 30");
          }else{
             System.out.print("这是 else 语句");
          }
       }
    }
    public class Test {
     
       public static void main(String args[]){
          int x = 30;
          int y = 10;
     
          if( x == 30 ){
             if( y == 10 ){
                 System.out.print("X = 30 and Y = 10");
              }
           }
        }
    }
  • 相关阅读:
    Variant 数组
    socket c/s分佈式編程
    多線程幾個方法說明
    hash表的使用
    MIS系统权限控制的一个简便方法
    git 使用总结
    让 VAGRANT 启动并运行起来
    深入理解 Laravel 中 config 配置加载原理
    Vagrant入门
    php开发APP接口(总结一)
  • 原文地址:https://www.cnblogs.com/tszr/p/10960099.html
Copyright © 2011-2022 走看看