hashmap + readline
时间:2010-03-01 来源:huanghaojie
package test;
import java.io.*;
import java.util.HashMap;
public class hashmap {
public void input(){
HashMap map=new HashMap();
map.put("1", "lishuo");
map.put("2", "qinpan");
System.out.println("请输入学号:");
BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
try {
String sno=strin.readLine();
System.out.println(map.get(sno));
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new hashmap().input();
}
} http://zhidao.baidu.com/question/98092619.html?fr=ala0
import java.io.*;
import java.util.HashMap;
public class hashmap {
public void input(){
HashMap map=new HashMap();
map.put("1", "lishuo");
map.put("2", "qinpan");
System.out.println("请输入学号:");
BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
try {
String sno=strin.readLine();
System.out.println(map.get(sno));
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new hashmap().input();
}
} http://zhidao.baidu.com/question/98092619.html?fr=ala0
相关阅读 更多 +