logo Practice-It logo

BJP4 Self-Check 6.17: printEntireFile

Language/Type: Java file processing Scanner
Author: Marty Stepp (on 2016/09/08)

Write a method named printEntireFile that prompts the user for a file name and prints the contents of that file to the console as output. You may assume that the file exists. For example, if the file example.txt contains the following input data:

hello  how    are you
1 2 3 4

I am fine

Then the following would be an example dialogue of your method:

Type a file name: example.txt
hello  how    are you
1 2 3 4

I am fine
Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.