About Question : enthuware.ocpjp.v8.2.1671
Moderators: Site Manager, fjwalraven
-
- Posts: 4
- Joined: Tue Mar 28, 2017 1:25 pm
- Contact:
About Question : enthuware.ocpjp.v8.2.1671
Hello, in Test 3 question 5 it asks:
What is the state of the WatchKey at the end of the following code?
Path path = Paths.get("C:/temp");
WatchService watchService = FileSystems.getDefault().newWatchService();
path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_MODIFY,
StandardWatchEventKinds.ENTRY_DELETE);
WatchKey key = watchService.take();
In my opinion the state for key is ready, because no event has triggered so far.
I understand the api also like that.
If the first event occurs, then the state would become signaled.
But in the answers it says "signaled" is right.
Can you verify please ?
Best regards
What is the state of the WatchKey at the end of the following code?
Path path = Paths.get("C:/temp");
WatchService watchService = FileSystems.getDefault().newWatchService();
path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_MODIFY,
StandardWatchEventKinds.ENTRY_DELETE);
WatchKey key = watchService.take();
In my opinion the state for key is ready, because no event has triggered so far.
I understand the api also like that.
If the first event occurs, then the state would become signaled.
But in the answers it says "signaled" is right.
Can you verify please ?
Best regards
Last edited by admin on Tue Mar 28, 2017 9:50 pm, edited 1 time in total.
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question :
The qid that you have mentioned is for OCAJP 8 question bank but the question belongs to some other question bank. Can you please specify the correct question id or the certification so that I can look it up?
-Paul.
-Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Tue Mar 28, 2017 1:25 pm
- Contact:
Re: About Question :
Sorry, my mistake.
enthuware.ocpjp.v8.2.1671
Test 3, question 5
enthuware.ocpjp.v8.2.1671
Test 3, question 5
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question :
The last line is watchService.take(); The call to take will wait until there is an event. Therefore, the status after this line will be Signaled and not Ready.
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Tue Mar 28, 2017 1:25 pm
- Contact:
Re: About Question : enthuware.ocpjp.v8.2.1671
Well, after this line it will probably be signaled, maybe not, if no event is triggered in the specified folder.
The question says "at the end of the code", NOT after the code with following events in the folder.
So this is IMO a bit mistakeable and i would still say the answer to the question like it is written is ready, not signaled.
API says: "A watch key has a state. When initially created the key is said to be ready. When an event is detected then the key is signalled "
At the end of the code there is no event, so i am pretty sure the state is ready.
The question says "at the end of the code", NOT after the code with following events in the folder.
So this is IMO a bit mistakeable and i would still say the answer to the question like it is written is ready, not signaled.
API says: "A watch key has a state. When initially created the key is said to be ready. When an event is detected then the key is signalled "
At the end of the code there is no event, so i am pretty sure the state is ready.
-
- Site Admin
- Posts: 10043
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question : enthuware.ocpjp.v8.2.1671
I have updated the problem statement to make it clear.
thank you for your feedback!
thank you for your feedback!
If you like our products and services, please help us by posting your review here.
-
- Posts: 4
- Joined: Tue Mar 28, 2017 1:25 pm
- Contact:
Who is online
Users browsing this forum: No registered users and 16 guests