Mar*_*ens 10
在文件名中使用时间戳,这样您就可以确定它是唯一的.
import java.io.*;
class FileWrite
{
public static void main(String args[])
{
try{
// Create file
FileWriter fstream = new FileWriter(System.currentTimeMillis() + "out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是谷歌非常容易的事情.
| 归档时间: |
|
| 查看次数: |
35817 次 |
| 最近记录: |