Files and exceptions

  • 10
  • Locked
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();
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
LennyMan
Level 25 , Lucca, Italy
8 January 2021, 12:08
Hint: Check the try-with-resources Statement
Andrew
Level 29 , Seattle, United States
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.