Question: Sketch a java program to perform File input/output. 1. Open a new file (data.txt) and associate it with a new PrintWriter; 2. Write a new
Sketch a java program to perform File input/output.
1. Open a new file ("data.txt") and associate it with a new PrintWriter;
2. Write a new line of text into the file (e.g., "I like (or do not like) to program in Java.")
3. Close the appropriate input object.
4. Create a Scanner to associate with the data file;
5. Read the words from the data.txt file.
6. (Optionally) close the input object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
