Free 1Z0-805 Braindumps


  • Exam Number: 1Z0-805
  • Provider: Oracle
  • Questions: 90
  • Updated On: 17-Nov-2018

QUESTION: 1
Which statement is true about the take method defined in the WatchService interface?

A. Retrieves and removes the next watch key, or returns nul of none are present.
B. Retrieves and removes the next watch key. If a queued key is not immediately available, the
program waits for the specified wait time.
C. Retrieves and removes the next watch key: waits if no key is yet present.
D. Retrieves and removes all pending events for the watch key, returning a list of the events that
were retrieved.
Answer(s): C
Explanation:
The WatchKey take() method retrieves and removes next watch key, waiting if none are yet
present.
Note: A watch service that watches registered objects for changes and events. For example a
file manager may use a watch service to monitor a directory for changes so that it can update its
display of the list of files when files are created or deleted.
A Watchable object is registered with a watch service by invoking its register method, returning
a
WatchKey to represent the registration. When an event for an object is detected the key is
signal ed, and if not currently signal ed, it is queued to the watch service so that it can be
retrieved by consumers that invoke the pol or take methods to retrieve keys and process
events. Once the events have been processed the consumer invokes the key's reset method to
reset the key which allows the key to be signal ed and re-queued with further events.
Reference: Interface WatchService

QUESTION:
2
Given the code fragment:

private static void copyContents (File source, File target) {
try {inputStream fis = new FileInputStream(source);
outputStream fos = new FileOutputStream (target);
byte [] buf = new byte [8192];
int i;
while ((i = fis.read(buf)) != -1) {
fos.write (buf, 0, i);
}
//insert code fragment here. Line **
System.out.println ("Successfully copied");
}
Which code fragments, when inserted independently at line **, enable the code to compile?

A. }catch (IOException | NoSuchFileException e) {
System.out.println(e);
}

B. } catch (IOException | IndexOutOfBoundException e) {
System.out.println(e);
}

Get The Premium Version

Allbraindumps.com
 Test Questions PDF from Myitguides.com

 Test Questions PDF from Myitguides.com