← Quiz: File Handling in Java: all 10 questions
Quiz: File Handling in Java · Question 3 of 10
What does BufferedReader.readLine() return at the end of the file?
What does BufferedReader.readLine() return at the end of the file?
- A.An empty string
- B.null
- C.-1
- D.It throws EOFException
Answer & explanation
Correct answer: null
null means there are no more lines, which is why the loop condition checks (line = in.readLine()) != null.
Can you get the rest right without peeking?
Take the timed Quiz: File Handling in Java quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →