Question: Modify the PrintInitials program so that it takes input from the keyboard but prints output to a file named output.txt. Use these suggestions: Add import

Modify the PrintInitials program so that it takes input from the keyboard but prints output to a file named output.txt. Use these suggestions:

Add import java.io.PrintWriter; Append throws Exception to the main method header. Add this declaration:

Add import java.io. PrintWriter; Append throws Exception to the main method header. Add this declaration: PrintWriter fileOut = new PrintWriter("output.txt"); Substitute fileOut.println for System.out.println. Then add this final statement to the main method: fileOut.close();

Step by Step Solution

3.43 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the modified PrintInitials program according to your suggestions import javaioPri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!