import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class aaaaaaa {
public static void main(String[] args) throws IOException {
FileWriter file = new FileWriter("F:\\IO\\IO02\\新建文本文档.txt",true);
Scanner sc = new Scanner(System.in);
while(true){
String str =sc.next();
if(str.equals("exit")){
System.out.println("退出程序");
System.exit(0);
}else{
file.write(str);
}
file.close();
}
}
}
麻烦看下我的代码有什么问题?
|
|