4

File Input and Output

Contents

  • Alternative program input/output
  • Data files
  • Text and binary files
  • Reading and writing to files
4.1 INTRODUCTION

In Chapter 3, we examined processes for reading input from a keyboard and displaying output on screen. Alternatively, a program’s data might come from backing storage and its output may be written there. Files—their types, access and processing—represent a very wide topic to which one cannot do full justice in a study of data structures. Java has a number of methods for reading from and writing to data files, and we will briefly examine some of them in this chapter in the context of program input and output. They will be used in case studies later in this book.

4.2 TEXT AND BINARY FILES

We distinguish ...

Get Introducing Data Structures with Java 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.