The exception which is checked by the compiler at the time of
compilation for smooth execution of the program is known as checked exception.
Example:
import java.io.*;
class Test{
public static void main(String[] args){
PrintWriter pw=new PrintWriter("abc.txt");
pw.println("SILAN TECHNOLOGY");
}
}
sometimes the compiler check some specific program for smooth execution at run time, so when we compile this program we will get following compile time error :
Example:
import java.io.*;
class Test{
public static void main(String[] args){
PrintWriter pw=new PrintWriter("abc.txt");
pw.println("SILAN TECHNOLOGY");
}
}
sometimes the compiler check some specific program for smooth execution at run time, so when we compile this program we will get following compile time error :
unreported exception
java.lang.FileNotFoundException must be caught or declared to be thrown
No comments:
Post a Comment