If your goal is to throw away RuntimeExceptionwhen the second argument 0, you don't need to do anything.
private int divide(int i1, int i2) {
return i1/i2;
}
ArithmeticException, RuntimeException, RuntimeException.
: , .
else, , , else - , , return, .
if, , else , , return , , , return .
private int divide(int i1, int i2) {
if(i2 == 0) {
return 0;
}
return i1/i2;
}