Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
21.5. Java NIO.2 Enhancements (Java 7+)
This section
Practice test
11 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
2 cards from this lesson. Good the night before a test.
Try these first
- 1.
What does the WatchService API do?
Hint
Consider changes within directories.
- 2.
What is a symbolic link?
Hint
Think of it as a shortcut.
- 3.
What functionality does the WatchService API provide?
- Monitor file system events
- Manage database connections
- Create GUI elements
Hint
Think about how applications can respond to filesystem changes.
- 4.
AccessDeniedException is thrown when you try to access what?
- Non-existent files
- Restricted files/directories
- Files without read permissions
Hint
Focus on permissions and access rights.
- 5.
Design a small Java application that utilizes the WatchService API to monitor a folder and log changes in a file.
Hint
Focus on correctly registering the directory and handling WatchKey events.
- 6.
Create a scenario where AccessDeniedException might be triggered and explain how you would handle it in code.
Hint
Consider user permissions and how exceptions can lead to better user feedback.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
1 more question available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting