- class PrintWriterDemo
- {
- public static void main(String[] args) throws IOException
- {
- File file = new File("con.txt");
- if(!file.exists())
- file.createNewFile();
- BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in));
- String line = new String();
- PrintWriter pw = new PrintWriter(new FileOutputStream(file), true);
- while(!(line = bufr.readLine()).equals("quit"))
- {
- pw.println(line);
- }
- bufr.close();
- pw.close();
- System.out.println("Hello World!");
- }
- }
复制代码
你能找出这个程序的问题在哪里吗???
|