Read file names from the console. If the file does not exist (i.e. an invalid file name is given), then catch the FileNotFoundException, display the invalid file name, and exit the program. Close the streams. Don't use System.exit();
Files and exceptions
You must be signed in to leave a comment
8 January 2021, 12:08
Hint: Check the try-with-resources Statement
25 February 2019, 16:26
Typo: Says "...(i.e. an valid file name is given)... Should be "...an invalid file name..."
Alex Vypirailenko Java Developer at Toshiba Global Comme
25 February 2019, 17:04
Thanks. We'll get that fixed soon.