Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 105

Given the code fragment:

Which code fragment, when inserted at line n1, enables the code to print /First.txt?

    Correct Answer: D

    To enable the code to print '/First.txt', the correct code fragment to be inserted at line n1 is 'Path iP = Paths.get("/", "First.txt");'. This is because the correct way to get a Path object in Java is by using the static 'get' method of the 'Paths' class. The 'Paths.get' method can take multiple string arguments to construct the path. Therefore, option D is correct.

Discussion
Svetleto13Option: D

D,tested

steefaandOption: D

D is correct. Path is instantiated using Paths class and method get.