赞
踩
- import java.io.*;
- public class InputTest{
- public static void main(String[] args) throws IOException{
- BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
- BufferedWriter buf2 = new BufferedWriter(new FileWriter("test.txt"));
- System.out.println("请输入想要说的话:");
- String str = buf.readLine();
- while(!str.equals("YES")){
- buf2.write(str);
- buf2.newLine();
- System.out.println("是否退出?输入YES退出:");
- str = buf.readLine();
- }
- buf.close();
- buf2.close();
- }
- }
保存为InputTest.java【同上节,我还是把他放在了D盘下InputTest文件夹内】 Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。