O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Image Chapter 10 Self Test

1. Why does Java define both byte and character streams?

2. Even though console input and output is text-based, why does Java still use byte streams for this purpose?

3. Show how to open a file for reading bytes.

4. Show how to open a file for reading characters.

5. Show how to open a file for random-access I/O.

6. How can you convert a numeric string such as “123.23” into its binary equivalent?

7. Write a program that copies a text file. In the process, have it convert all spaces into hyphens. Use the byte stream file classes. Use the traditional approach to closing a file by explicitly calling close( ).

8. Rewrite the program ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required