Trying to rename both directory name and file name.
try
{
File dir = new File("DIR");
dir.mkdir();
File file1 = new File(dir,"myfile1.txt");
file1.createNewFile();
File file2 = new File(dir,"myfile2.txt");
file2.createNewFile();
dir.renameTo(new File("myDIR"));
System.out.print(file1.renameTo(new File(dir,"myf1.txt")));
}
catch(IOException ie)
{
}
However,only directory is being successfully renamed and not the filename.
can these operations not be done simultaneously?