Appendix    A

Answers to Exercises

Each of Chapters 1 through 14 closes with an “Exercises” section that tests your understanding of the chapter’s material. The answers to those exercises are presented in this appendix.

Chapter 1: I/O Basics and APIs

  1. The API categories that comprise classic I/O are File, RandomAccessFile, the stream classes, and the writer/reader classes.
  2. The benefit of the try-with-resources statement is a reduction in verbosity. You can use this statement to automatically close open files and other resources instead of having to provide this resource-closing code.
  3. The API categories that comprise NIO are buffers, channels, selectors, regular expressions, charsets, and a printf-style formatting facility based mainly on the ...

Get Java I/O, NIO and NIO.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.