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");
              }
           }
        }
    }
  • 相关阅读:
    js中的面向对象part2
    js中值类型和引用类型的区别
    js中三大引用类型
    js中的重点
    html和css区别
    面向对象part1
    null和undefined的区别
    前端面试题js篇
    行内元素和块级元素的区别
    学习网站
  • 原文地址:https://www.cnblogs.com/tszr/p/10960099.html
Copyright © 2011-2022 走看看