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);
}
}
}
posted @ 2012-03-22 17:53  hnrainll  阅读(571)  评论(0编辑  收藏  举报