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.2. Java NIO (java.nio Package)
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
4 cards from this lesson. Good the night before a test.
Try these first
- 1.
What are Buffers used for in Java NIO?
Hint
Think of Buffers as containers.
- 2.
What is the purpose of a Channel?
Hint
Consider what connects Buffers to the outside world.
- 3.
What is a Buffer in Java NIO?
- Container for data
- File handler
- None of the above
Hint
Reflect on what holds data temporarily.
- 4.
True or False: Selectors can manage multiple channels with one thread.
- True
- False
Hint
Think about resource management in applications.
- 5.
Design a non-blocking server using Selectors that accepts multiple client connections and processes reads.
Hint
Think about how to manage readiness and read events.
- 6.
Write code to demonstrate reading lines from a file using Path and Files in NIO.
Hint
Focus on the methods that handle file input.
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