A)
class withouthandling {
public static void main(String[] args) {
int n,d,q=1;
System.out.println("program is started :");
n=Integer.parseInt(args[0]);
d=Integer.parseInt(args[1]);
q=n/d;
System.out.println("the result of division is :"+q);
System.out.println("the application completely executed");
}
}
Run: Java withouthandling 10 0
->when we supply “10” , “0” the program is terminated abnormally. Because exception is raised at run time. But compiler doesn’t raised error. But JVM raised the exception (Arithmetic Exception).
->whenever JVM find the exception it calibrate the what kind of Exception abnormal.
->then corresponding class is (library class) load into memory.
->creates the Exception object and throws.
->so that Exception object can’t catch by anybody.
->so, that’s why this program is terminated abnormally.
Comments
Post a Comment