zoukankan      html  css  js  c++  java
  • switch

     1 package com.cn;
     2 
     3 public class Test {
     4     public static void main(String agrs[]){
     5         int x = 1;
     6         switch(x){
     7             case 1 : 
     8                 System.out.println("1");
     9             case 2 :
    10                 System.out.println("2");
    11             default :
    12                 System.out.println("others");
    13         }
    14     }
    15 }

    输出结果:

    1
    2
    others

    package com.cn;
    
    public class Test {
        public static void main(String agrs[]){
            int x = 2;
            switch(x){
                case 1 : 
                    System.out.println("1");
                case 2 :
                    System.out.println("2");
                default :
                    System.out.println("others");
            }
        }
    }

    输出结果:

    2
    others

     1 package com.cn;
     2 
     3 public class Test {
     4     public static void main(String agrs[]){
     5         int x = 2;
     6         switch(x){
     7             case 1 : 
     8                 System.out.println("1");
     9                 break;
    10             case 2 :
    11                 System.out.println("2");
    12                 break;
    13             default :
    14                 System.out.println("others");
    15         }
    16     }
    17 }

    输出结果:

    2

     1 package com.cn;
     2 
     3 public class Test {
     4     public static void main(String agrs[]){
     5         int x = 2;
     6         switch(x){
     7             case 1 : 
     8                 System.out.println("1");
     9                 break;
    10             case 2 :
    11             case 3 :
    12                 System.out.println("2");
    13                 break;
    14             default :
    15                 System.out.println("others");
    16         }
    17     }
    18 }

    输出结果:

    2

  • 相关阅读:
    RoIPooling、RoIAlign笔记
    ROI Align 的基本原理和实现细节
    ROI Align详解
    GIT总结
    java-变量,函数 下
    linux设置静态ip地址
    技术参考网站-网址
    python
    python
    python
  • 原文地址:https://www.cnblogs.com/lzy1991/p/5097301.html
Copyright © 2011-2022 走看看