- import java.io.*;
- public class Test1 {
- public static void main(String[] args) throws IOException{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- BufferedWriter bw = new BufferedWriter(new FileWriter("d:\\a.txt"));
- String line = null;
- while((line= br.readLine())!=null){
- //System.out.print(line);
- bw.write(line);
- bw.newLine();
- bw.flush();
- if("over".equals(line)){
- break;
- }
- }
- bw.close();
- br.close();
- }
- }
复制代码 我给你说你的代码的意思是 if是over, 才 可以写入流而且输出的是“over”输入其他都和没有输入一样
|