Hi,
I am trying to learn exceptions using "throws".
So , my code is
public class A {
public static void main(String args[]) {
A a = new A();
int x1;
int x2;
x1 = 7;
x2 = 0;
a.printer(x1, x2);
}
void printer(int x1, int x2) throws ArithmeticException{
System.out.println("Add: "+(x1+x2));
System.out.println("Sub: "+(x1-x2));
System.out.println("Mul: "+(x1*x2));
System.out.println("Div: "+(x1/x2));
}
}
What is my wrong in div that program exits ??
I use throws ArithmeticException.