Advertisement
jac_usai

Untitled

Jun 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main (String[] args){
  4.  
  5.         myMethod();
  6.         try{
  7.             myMethod();
  8.             mySecondMethod();
  9.         }catch(Exception e){
  10.             System.out.println("Eccezione");
  11.         }
  12.         finally {
  13.             System.out.println("Sono ancora vivo");
  14.         }
  15.     }
  16.  
  17.     public static void myMethod(){
  18.         throw new MyException("Una eccezione checked");
  19.     }
  20.  
  21.     public static void mySecondMethod() throws Exception{
  22.         throw new Exception("Una eccezione unchecked");
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement