Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class Etest{
  2. private static int check(int n)
  3. throws Exception
  4. {
  5. if (n<0)
  6. throw new Exception(n + " is negative.");
  7. return n;
  8. }
  9. public static void main(String[] args){
  10. int s = 0;
  11. try{
  12. s += check(-1);
  13. }catch(Exception e){
  14. System.out.println(e.getMessage());
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement