Oracle
1Z0-809 · Question #253
Given that data.txt and alldata.txt are accessible, and the code fragment: ``java public void writeFiles() throws IOException { BufferedReader br = new BufferedReader(new FileReader("data.txt"))…
The correct answer is D. bw.append(line + "\n"). You've hit your session limit · resets 5:20pm (America/New_York)
Question
Given that data.txt and alldata.txt are accessible, and the code fragment:
public void writeFiles() throws IOException {
BufferedReader br = new BufferedReader(new FileReader("data.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("alldata.txt"));
String line = null;
while ((line = br.readLine()) != null) {
// line n1
}
}
What is required at line n1 to enable the code to overwrite alldata.txt with data.txt?Options
- Abr.close();
- Bbw.writeln();
- Cbw.flush();
- Dbw.append(line + "\n");
How the community answered
(12 responses)- A8% (1)
- B17% (2)
- D75% (9)
Explanation
You've hit your session limit · resets 5:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.