Question
If a program must use a file several times, is it better to open and close it each time or keep it open for the
If a program must use a file several times, is it better to open and close it each time or keep it open for the duration of the program?
In Exercise 3 earlier in this chapter, what did you discover about the size difference of files that held the same contents but were created using different software (such as Word and Notepad)? Why do you think the file sizes are so different, even though the files contain the same data?
Exercise 3
Create a file that contains your favorite movie quote. Use a text editor such as Notepad and save the file as quote.txt. Copy the file contents and paste them into a wordprocessing program such as Word. Save the file as quote.doc. Write an application that displays the sizes of the two files as well as the ratio of their sizes to each other. Save the file as FileStatistics2.java.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started