javase 自增自减运算符 三元运算符 switch语句
public class three { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = 10; int b = 20; int c = true ? a:b; System.out.println(c); //10 } }
int date = 1; switch (date) { case 1: System.out.println("周一"); break; case 2: System.out.println("周二"); break; case 3: System.out.println("周四"); break; case 5: System.out.println("周五"); break; case 6: System.out.println("周六"); break; case 7: System.out.println("周日"); break; default: System.out.println("数据不合理"); break;
case后面的数值不能重复
除了这几种数据类型之外,其他的数据类型均不能放在表达式中