🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.An empty string
  2. B.null
  3. C.-1
  4. 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 →