- Java code
try{ FileWriter fw = new FileWriter("hello.txt"); String s = url+"(on page " + base + ")\n"; fw.write(s,0,s.length()); fw.flush(); } catch(Exception e) {e.printStackTrace();}
------解决方案--------------------------------------------------------
用Append模式打开该文件,即:
FileWriter fw = new FileWriter("hello.txt", true);