Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 FileWriter 可以将文本写入文件。该文件根本没有被创建。我检查了当前的工作目录。此外,当我调试时,将文本写入文件的代码根本没有执行......有没有人遇到过类似的事情?
File ff = new File("ffile.txt"); FileWriter frr = new FileWriter(ff); frr.write("hello"); frr.close();
创建新文件使用createNewFile();
createNewFile();
File ff = new File("ffile.txt"); ff.createNewFile(); FileWriter frr = new FileWriter(ff); frr.write("hello"); frr.close();