About Question : enthuware.ocpjp.v8.2.1671
Posted: Tue Mar 28, 2017 1:30 pm
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