Question 141

Given the code fragment:
Path currentFile = Paths.get("/scratch/exam/temp.txt");
Path outputFile = Paths get("/scratch/exam/new.txt");
Path directory = Paths.get("/scratch/");
Files.copy(currentFile, outputFile);
Files.copy(outputFile, directory);
Files.delete (outputFile);
The /scratch/exam/temp.txt file exists. The /scratch/exam/new.txt and /scratch/new.txt files do not exist.
What is the result?
  • Question 142

    Given:

    and omitting the throws FooException clause results in a compilation error.
    Which statement is true about FooException?
  • Question 143

    Which set of commands is necessary to create and run a custom runtime image from Java source files?
  • Question 144

    Given the code fragment:
    var pool = Executors.newFixedThreadPool(5);
    Future outcome = pool.submit(() > 1);
    Which type of lambda expression is passed into submit()?
  • Question 145

    Given:

    and
    checkQuality(QUALITY.A);
    and

    Which code fragment can be inserted into the switch statement to print Best?