21.2.5 - Path, Paths, and Files (Java 7+)
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What class is used to represent file paths in the java.nio.file package?
💡 Hint: This class is not just a string; it has methods to handle paths.
How do you obtain a Path object from a string?
💡 Hint: It's a static method from the utility class.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
Which class is NOT part of the java.nio.file package?
💡 Hint: Think about the organization of these classes in packages.
The Paths class is a utility to create Path instances.
💡 Hint: Consider what utility classes generally provide.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a complete Java program to read a file, count the number of lines, and print them to the console, handling any exceptions that may occur.
💡 Hint: Don't forget to add exception handling.
Modify the previous program to create a new file and write the contents of the original file into it, combining them into one.
💡 Hint: Ensure the target file is created without overwriting existing files.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.