Advertisement
xeritt

Test finally and System.exit(0)

Nov 24th, 2017
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. public class TestFinally{
  2.     public int test(){
  3.         try {
  4.             throw new Exception();
  5.         } catch (Exception npe){
  6.             System.out.println("Exception");
  7.             //return 0;
  8.             System.exit(0);
  9.         } finally{
  10.             System.out.println("Finally");
  11.         }  
  12.         return 0;      
  13.     }  
  14.    
  15.     static public void main(String args[]){
  16.         System.out.println("Hello");
  17.         Main main = new Main();
  18.         int i = main.test();
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement