Java switch语句
package cn.geekeryi; public class SwitchTest { public static void main(String[] args) { int grade = 2; if (grade==1){ System.out.println("大一,爱上大学"); }else if (grade==2){ System.out.println("大二,开始撩妹"); }else if (grade==3){ System.out.println("大三,女友怀孕"); }else{ System.out.println("大四,毕业生子"); } switch(grade){ case 1: System.out.println("大一,爱上大学"); break; case 2: System.out.println("大二,开始撩妹"); break; case 3: System.out.println("大三,女友怀孕"); break; default: System.out.println("大四,毕业生子"); break; } } }