Professional Documents
Culture Documents
21BCE8189- OOPS LAB 1
21BCE8189- OOPS LAB 1
21BCE8189- OOPS LAB 1
ANS)
// Handling ArithmeticException
try {
int a = 10;
int b = 0;
} catch (ArithmeticException e) {
// Handling NullPointerException
try {
} catch (NullPointerException e) {
// Handling ArrayIndexOutOfBoundsException
try {
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Caught ArrayIndexOutOfBoundsException: " + e.getMessage());
// Handling NumberFormatException
try {
} catch (NumberFormatException e) {