Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: What is the purpose of the 'FileNotFoundException' in Java?
Answer: 'FileNotFoundException' is thrown when an attempt to open the file denoted by a specified pathname has failed.

Example:

try { FileReader fr = new FileReader("nonexistent.txt"); } 
catch (FileNotFoundException e) { /* handle file not found exception */ }
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook