import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;
public class work {
public static void main(String[] args) throws IOException {
PrintStream ps = new PrintStream("D:\\a.txt");
Scanner input = new Scanner(System.in);
System.out.println("请输入要写入文件夹的内容:");
while (true) {
String a = input.nextLine();
//如果输入内容为exit,则退出!
if (a.equals("exit")) {
break;
}
//如果输入内容不为exit,则写入
ps.println(a);
}
System.out.println("写入成功!");
ps.close();
}
}