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
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.
Step by Step Solution
3.34 Rating (151 Votes )
There are 3 Steps involved in it
First lets focus on the task at hand You are asked to write a program that compacts a file ie moves all active records to the beginning of the file an... View full answer
Get step-by-step solutions from verified subject matter experts
