Question: In Problem 16, you wrote a piece of code that prompted the user for a file name and printed that files contents to the console.

In Problem 16, you wrote a piece of code that prompted the user for a file name and printed that file’s contents to the console. Modify your code so that it will repeatedly prompt the user for the file name until the user types the name of a file that exists on the system.


Data from Problem 16

Write a program that prints itself to the console as output. For example, if the program is stored in Example.java, it will open the file Example.java and print its contents to the console.

Step by Step Solution

3.43 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Code that uses getFileName before calling printEntireFile ... 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 Building Java Programs A Back to Basics Approach Questions!