package java_training;
public class Throwexception {
public static void main(String args []) {
int a=44,b=0,d;
try {
if(b==0)
throw(new ArithmeticException("Can`t divide by zero"));
else {
d=a/b;
System.out.println("\n\tThe resut is:");
}
}
catch(ArithmeticException Ex) {
System.out.println("\n\tError:");
}
System.out.println("\n\tEnd the program");
}
}
public class Throwexception {
public static void main(String args []) {
int a=44,b=0,d;
try {
if(b==0)
throw(new ArithmeticException("Can`t divide by zero"));
else {
d=a/b;
System.out.println("\n\tThe resut is:");
}
}
catch(ArithmeticException Ex) {
System.out.println("\n\tError:");
}
System.out.println("\n\tEnd the program");
}
}

0 Comments