Switch用法

时间:2022-08-02 21:14:57

package com.cz.test;

public class SwitchExample1 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int age=1;
switch (age) {
case 20:
System.out.println("您的年龄是20岁");
break;
case 18:
System.out.println("您的年龄是18岁");
break;
default:
break;
}
}

}