Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Functionality {
- public static int add(int a, int b) throws NegativeNumberException {
- if (a < 0 || b < 0) {
- throw new NegativeNumberException();
- }
- int ergebnis = a + b;
- return ergebnis;
- }
- }
- =======================================================================================================================
- public class NegativeNumberException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement