CHAPTER 7

image

Working with Files

In this chapter, we will explain the following:

  • The difference between text files and binary files
  • The difference between internal and external file names
  • How to write a program to compare two text files
  • The try . . . catch construct
  • How to perform input/output with binary files
  • How to work with a binary file of records
  • What are random access files
  • How to create and retrieve records from random access files
  • What are indexed files
  • How to update a random access file using an index

7.1 Input/Output in Java

Java has a comprehensive range of classes for performing input/output. We have used System.in and System.out

Get Advanced Topics in Java: Core Concepts in Data Structures 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.