Java重命名文件
File file = new File("oldname");
File file2 = new File("newname");
if (file2.exists())
throw new java.io.IOException("file exists");
boolean success = file.renameTo(file2);
if (!success) {
}
Loading...
File file = new File("oldname");
File file2 = new File("newname");
if (file2.exists())
throw new java.io.IOException("file exists");
boolean success = file.renameTo(file2);
if (!success) {
}