Yes, and you also need space on the file system. But all those things are irrelevant from the exam point of view. But it is not a limitation of the File class. It is capable do creating a file in any directory provided other things required for it are available (which you should assume for the exam.).
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
One of the alternatives which is marked as correct in this question is:
"Once created there is no way to change the file or directory that the File object represents."
I think this is indeed incorrect. When you invoke File.renameTo(anotherFileObject) exactly what you are doing is: changing the file which the File object represents. Yes, I understand that the File object itself is not changed, only what it represents in the filesystem. And I guess that is what you actually mean. But what you do state in the alternative marked correct, is that the file or directory which the File object represents, cannot be changed after creation of the File object.
What it intends to convey is that the File object will always represent the same file. It cannot be changed to represent some other file. But yes, you are right, it may be interpreted differently.
Updated to, "Once created there is no way to change the File object to represent a different file or directory."
thank you for your feedback!
If you like our products and services, please help us by posting your review here.