In the above code all are working fine. I just created a file "test.txt" and the rename the file by using the "renameTo()" method.
I printed the name of the file by invoking the "getNme()" method. The renameTo() method rename the file "test.txt" to "test1.txt"
but the program prints same for both the print method :
File name :test.txt //before renaming
File name :test.txt //after renaming
So the question is that why the second one "test.txt" why not "test1.txt" while the file "test.txt" is renamed to "test1.txt"