Page 1 of 1

About Question enthuware.ocpjp.v8.2.1402 :

Posted: Mon Jun 06, 2016 2:24 pm
by ntotomanov
Hello,

One of the answers states:
You can create files in any directory using File class's API.
but in real life that is not correct. You need certain privileges in order create files/directories

Could you please comment on that

Re: About Question enthuware.ocpjp.v8.2.1402 :

Posted: Mon Jun 06, 2016 9:39 pm
by admin
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.

Re: About Question enthuware.ocpjp.v8.2.1402 :

Posted: Sat Sep 11, 2021 7:14 am
by myrling
Hi!

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.

Regards,

Re: About Question enthuware.ocpjp.v8.2.1402 :

Posted: Sat Sep 11, 2021 8:57 pm
by admin
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!