Java获取键盘输入[CODE]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main (String args[]){
//实例化一个流,用于获取键盘输入
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String theLine = null;
while(true){
try {
theLine = in.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("theLine is: " + theLine);
}
}
}
欢迎访问:wenhao.ink