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.1. Java I/O (java.io Package)
This section
Practice test
12 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 is the purpose of the FileInputStream class?
Hint
Think about how you would read binary data.
- 2.
What does serialization mean in Java?
Hint
Consider what happens when you save an object.
- 3.
What is the main purpose of the java.io package?
- For network programming
- For input and output operations
- For creating graphics
Hint
Think about what the package is primarily used for.
- 4.
True or False: A File class object can represent both files and directories.
- True
- False
Hint
Consider the versatility of handling file systems in Java.
- 5.
Design a Java application that reads a large binary file using FileInputStream, processes each byte, and writes the processed data to a new file using FileOutputStream.
Hint
Think of how to handle file streams effectively in a loop.
- 6.
Create a class that uses serialization to save an object to a file, and another class to read the object back into memory. Be sure to handle exceptions appropriately.
Hint
Consider how serialization affects object state management.
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
2 more questions 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