About Question enthuware.ocpjp.v8.2.1402 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ntotomanov
Posts: 6
Joined: Tue Jan 19, 2016 4:30 pm
Contact:

About Question enthuware.ocpjp.v8.2.1402 :

Post 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

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

myrling
Posts: 2
Joined: Tue Aug 03, 2021 4:24 am
Contact:

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

Post 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,

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 60 guests