Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1.  
  2. static void testValue(int i) throws SmallException, BigException {
  3.  
  4. if(i < 5) {
  5. throw new SmallException("Value was lower than 5.");
  6. } else if(i > 10) {
  7. throw new BigException("Value was higher than 10.");
  8. }
  9.  
  10. }
  11.  
  12. static void printErrorReport(Exception e) {
  13. System.out.println(e.getMessage());
  14. }
  15. }
  16.  
  17. class SmallException extends Exception{
  18.  
  19. public SmallException(String s) {
  20. super(s);
  21. }
  22.  
  23.  
  24.  
  25. }
  26.  
  27. class BigException extends Exception{
  28.  
  29. public BigException(String s) {
  30. super(s);
  31. }
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement