Advertisement
sergAccount

Untitled

Feb 7th, 2021
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.mycompany.ja9;
  7.  
  8. public class Main2 {    
  9.    
  10.     public static void main(String[] args) {
  11.         //trycatch + tab      
  12.         try{
  13.             if(true){
  14.                 throw new Exception("EXCEPTION MESSAGE!!!");
  15.             }
  16.             System.out.println("HI!");
  17.         }catch(Exception exc){
  18.             exc.printStackTrace();
  19.         }finally{  // выполняется безусловно !!!
  20.             System.out.println("IN BLOCK FINALLY");
  21.         }          
  22.         System.out.println("OK!!!");
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement