Chapter 9Using Java I/O API

  1. What exception is expected to be thrown by the following code snippet?
     var oldPath = Path.get("/rodent/mouse.txt");
     var newPath = Path.get("/rodent/rat.txt");
     Files.move(oldPath, newPath,
        StandardCopyOption.REPLACE_EXISTING);
     
    1. AtomicMoveNotSupportedException
    2. DirectoryNotEmptyException
    3. FileAlreadyExistsException
    4. The code does not compile.
    5. None of the above.
  2. What is the result of compiling and executing the following program? ...

Get OCP Oracle Certified Professional Java SE 17 Developer Practice Tests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.