The data.doc, data.txt and data.xml files are accessible and contain text.



Given the code fragment:

What is the result?

A. The program prints the content of data.txt file.
B. The program prints:

Exception
〈The content of the data.txt file〉
Exception

C. A compilation error occurs at line n1.
D. The program prints the content of the three files.

題解

程式第24行開始會保留路徑為「txt」結尾的Path物件,接著讀取剩下來的路徑所指到的檔案之所有的內容,並輸出至標準輸出串流中。paths變數參考到的串流物件中的Path物件,只有「data.txt」會被filter保留,因此只會讀取並輸出「data.txt」的檔案內容。