Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public class Functionality {
  2.  
  3. public static int add(int a, int b) throws NegativeNumberException {
  4.  
  5. if (a < 0 || b < 0) {
  6. throw new NegativeNumberException();
  7. }
  8.  
  9. int ergebnis = a + b;
  10.  
  11. return ergebnis;
  12. }
  13. }
  14.  
  15. =======================================================================================================================
  16.  
  17. public class NegativeNumberException extends Exception {
  18.  
  19. /**
  20. *
  21. */
  22. private static final long serialVersionUID = 1L;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement