



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




(c) FileNotReadyException (d) all of the above
(d) getName()
Explain the differences between a text file, an ASCII file and a binary file. Write a Java statement to create and open an output stream to a file named autos.txt. Explain what happens when an output file is opened in Java. Write a Java method that returns a String representing a file name entered by the user. Use the output stream to the file autos.txt created above in number 2 to write the line “Mercedes” to the file. What happens when the method close is invoked on a stream? Create try and catch block that opens a file named statistics.txt for output. Writes the integers 24, 55, and 76 to the file, and then closes the file. Answer: Answer: Write a Java statement that creates an output stream to append data to a file named autos.txt. Answer: Write a Java statement to create an input stream to a file named autos.txt. Answer: Write a complete Java program using a Scanner object that opens a file named autos.txt and displays each line to the screen.