读书人

java switch用法总结

发布时间: 2014-01-15 15:40:23 作者: rapoo

java switch用法小结
//1.用做整型public static void main(String[] args) throws IOException {char a;System.out.println("Enter a number from 1--3:");a = (char) System.in.read();switch (new Integer(a + "")) {// 不加""会变成AscIIcase 1:System.out.println("输入的是--> 1");break;case 2:System.out.println("输入的是--> 2");break;default:System.out.println("entry");}}

?

?

switch是不能用来判断字符串的!!

读书人网 >行业软件

热点推荐