consider the following code:
File s=new File("myfile.txt");
s.renameTo("myfile1.txt");
According to the
java API of File class "Instances of the File class are immutable; that is, once created, the abstract pathname represented by a File object will never change."
but the renameTo method does chang the Instances of the File "s" if the method return true.
maybe we can say it is equals to below:
File s=new File("myfile.txt");
s=new File("myfile1.txt");
We assume that no other references point to s.Can i say that the object created by new File("myfile.txt") is eligible for GC collection after s.renameTo("myfile1.txt") has been executed.Can anybody tell me if i am right or wrong,please! Thanx in advance.
------------------