Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public class ExceptionTest {
  2.  
  3.  
  4.  
  5. static void checkavailbility(int i) throws ResourceNotFound
  6. {
  7. if(i>0)
  8. {
  9. System.out.println("items available");
  10. }
  11. else
  12. {
  13. throw new ResourceNotFound("items not available");
  14. }
  15. }
  16.  
  17. public static void main(String args[]){
  18.  
  19. try
  20. {
  21. checkavailbility(0);
  22.  
  23. }
  24. catch(Exception e)
  25. {
  26. System.out.println("exception occured");
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement