EXCEPTION HANDLING
import java.io.*;
class exception {
public static void main(String[] args) {
int a = 5;
int b = 0;
try {
System.out.println(a / b);
} catch (ArithmeticException e) {
e.printStackTrace();
}
}
}
OUTPUT: java.lang.ArithmeticException: / by zero
No comments:
Post a Comment