switch语句的陷阱

下面的代码是编译不过去的。java

import java.io.*
public calss test{//条件表达式最终的数据类型应该和常量表达式一致
 public static void main(String args[])throw Exception
  String str;
     int a;
  BufferedReader buf;
  InputStreamReader isr = new InputStreamReader(System.in);
  buf = new BufferedReader(isr);
  str = buf.readLine();
  a = Integer.parseInt(str);
  switch(a)
 {
   case a<=100&&a>=90:
    System.out.println("优");break;
   default:System.out.println("dd");break;
 }it

}io

相关文章
相关标签/搜索