Rename file in java:


File file1 =new File("file1.txt");
File file2=new File("file2.txt");

file1.renameTo(file2);

Method File.renameTo(FILE) – returns true or false, depends on result.