Page 1 of 1

About Question enthuware.ocpjp.v8.2.1540 :

Posted: Sat Jan 14, 2017 11:07 am
by dr_astico

Code: Select all

Files.setAttribute(p, "dos:hidden", true, NOFOLLOW_LINKS);
Actually, the code above will not compile as is because "NOFOLLOW_LINKS" will not be resolved.

to make this option valid i have to assume either:

Code: Select all

LinkOption NOFOLLOW_LINK = LinkOption.NOFOLLOW_LINKS;
//Assuming appropriate LinkOption import statement
//a little ugly to read though
or:

Code: Select all

import static java.nio.file.LinkOption.*;
so obviously I have to assume correct imports, in any case.

In every question with code snippets there is a warning about to assume every correct import statements needed.
in this question: nothing, so this misleaded me to think the option was invalid.


my fault. Because these are not a code snippet in the question body: are the answers options,

right?

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

Posted: Sun Jan 15, 2017 12:06 am
by admin
Some questions that may seem to contain full listing explicitly ask you to assume imports only to avoid any confusion. But whenever you see a clearly partial/incomplete code listing, you should always assume appropriate imports.

HTH,
Paul.