The data file in Exercise E21.6 may end up with many deleted records that take up

Question:

The data file in Exercise •• E21.6 may end up with many deleted records that take up space. Write a program that compacts such a file, moving all active records to the beginning and shortening the file length. Hint: Use the setLength method of the Random AccessFile class to truncate the file length. Look up the method’s behavior in the API documentation.

Data from Exercise E21.6

Modify the BankSimulator program in Section 21.3 so that it is possible to delete an account. To delete a record from the data file, fill the record with zeroes.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: