I used the following code to rename a file and then get its new name:
File f1 = new File("C:/old.txt");
File f2 = new File("C:/new.txt");
System.out.println(f1.renameTo(f2));
System.out.println(f1.getName());
And the program returns
true
old.txt
renameTo() has succeeded, but why doesn't getName() return the new file name?