hello everybody i am new to java plz help me out...
I have written the following code in order to rename the file cfile.txt after adding some data in that file but renaming can't be happened.
import java.io.*;
public class File3
{
public static void main(String [] args)throws IOException
{
File b=new File("b");
b.mkdir();
File bfile=new File(b,"bfile.txt");
bfile.createNewFile();
File cfile=new File(b,"cfile.txt");
cfile.createNewFile();
FileWriter cwrite =new FileWriter(cfile);
cwrite.write("this is the secod file of directory");
cwrite.flush();
File abcd =new File(b,"abcd.txt");
System.out.println(cfile.renameTo(abcd));
}
}