← 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)?
- A.list is for files, walk is for folders
- B.list shows only the direct children; walk also goes into every sub-folder
- C.walk is the old java.io version of list
- 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 →