//输入流,源头:文件
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(new File(
"F:\\我的歌声里.txt"))));
String line = null;
while((line = br.readLine()) != null){
p.print(line);
}
**********************************************************************************************************
//输入流,源头:键盘
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(System.in)));
String line = null;
while((line = br.readLine()) != null){
p.print(line);
}
***********************************************************************************************************
为什么输入流是文件的时候可以读完,而如果是键盘的时候就不能读完、。?
|
|