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

Given that data.txt and alldata.txt are accessible, and the code fragment:

What is required at line n1 to enable the code to overwrite alldata.txt with data.txt?

    Correct Answer: D

    To ensure that all data buffered in the BufferedWriter is written out to 'alldata.txt', the 'bw.flush()' method should be called. This method forces any buffered output bytes to be written out, which is critical for ensuring that the content read from 'data.txt' is fully written to the 'alldata.txt'. Therefore, writing 'bw.flush();' at line n1 will enable the code to overwrite 'alldata.txt' with 'data.txt'.

Discussion
Svetleto13Option: D

Correct answer is D

steefaandOption: D

D is correct.

duydnOption: D

D is correct.

AVB22Option: D

D tested