我有接受用户输入的代码,所以我想将该用户输入保存到文本文件中。我正在搜索信息,但我真的找不到任何东西,也许我只是不知道如何正确搜索。我希望你能给我一些关于如何为我的问题找到解决方案的建议,将用户输入保存到文本文件中。
答案 0 :(得分:0)
很简单:
String inputFromUser = "Anything from User";
PrintWriter out = new PrintWriter("pathToSaveAndfilename.txt");
out.println(inputFromUser);
//When your file work is completed then don't forgot to close the file
out.close();