Class FileNotFoundException in Java
FileNotFoundException is thrown from an application to indicate that a file specified to perform some operation could not be found. It is caused by an attempt to access a nonexistent file. It is also a very common built-in exception class in java.
So in a nutshell, it is an IOException that signals that a specified file can not be found.
The structure of the class FileNotFoundException is given as:
public class java.io.FileNotFoundException extends java.io.IOException{
//constructor
public FileNotFoundException();
//constructs an empty FileNotFoundException object that is an object with no message specified.
public FileNotFoundException(String message);
//constructs an FileNotFoundException object with the message specified.
}
The class FileNotFoundException also inherits methods from class Object and Throwable.
From Object class | From Throwable class |
---|---|
clone() | fillInStackTrace() |
getClass() | getMessage() |
notify() | printStackTrace() |
wait() | printStackTrace(PrintWriter) |
wait(long, int) | getLocalizedMessage() |
wait(long) | printStackTrace(PrintStream) |
equals(Object) | |
toString() | |
finalize() | |
hashCode() | |
notifyAll() |