About Question enthuware.ocpjp.v7.2.1671 :

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

Moderator: admin

Post Reply
Deleted User 2779

About Question enthuware.ocpjp.v7.2.1671 :

Post by Deleted User 2779 »

Hi there,

I found this one a little misleading, and answered it wrong. I wondered if actual questions in the exam are like this? At the end of the code, it's not certain if any event has been fired.

I suppose, if there hasn't been an event, then 'key' would be null, and thus would not have any of the states.

So, the only way for 'key' not to be null, and have a state, is if there indeed has been an event. In which case it must be 'signaled'. :)

If 'key' had been assigned from the path.register' statement, then it could be either 'ready' or 'signaled', depending on whether an event had been fired or not. I think that's what confused me.

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

Re: About Question enthuware.ocpjp.v7.2.1671 :

Post by admin »

The call to watchService.take in the last statement WatchKey key = watchService.take(); will not return until there is an event and therefore the state must be signaled at the end of the code.

-Paul.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], tequilaa and 6 guests