🎙 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 10 of 10

What is the difference between Files.list(dir) and Files.walk(dir)?

What is the difference between Files.list(dir) and Files.walk(dir)?

  1. A.list is for files, walk is for folders
  2. B.list shows only the direct children; walk also goes into every sub-folder
  3. C.walk is the old java.io version of list
  4. D.There is no difference
Answer & explanation

Correct answer: list shows only the direct children; walk also goes into every sub-folder

Files.walk visits the whole tree (including dir itself); Files.list goes one level deep.

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 →