What does this code do when n2 is zero?
public static int safeDivide(int n1, int n2) {
try {
return n1 / n2;
} catch (ArithmeticException e) {
return 0; // Return zero in case of division by zero
}
}
What does this code do when n2 is zero?
public static int safeDivide(int n1, int n2) {
try {
return n1 / n2;
} catch (ArithmeticException e) {
return 0; // Return zero in case of division by zero
}
}