paramnumber1paramnumber2returnThe sumthrowsAddNumbersException if any of the numbers to be added is negative. if (number1 < 0 || number2 < 0) { throw new AddNumbersException("Negative number cant be added!", "Numbers: " + number1 + ", " + number2); } return number1 + number2;
if (number1 < 0 || number2 < 0) { throw new AddNumbersException("Negative number cant be added!", "Numbers: " + number1 + ", " + number2); } return number1 + number2;