Advertisement
sergAccount

Untitled

Feb 13th, 2021
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 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.app11;
  7.  
  8. /**
  9.  *
  10.  * @author Admin
  11.  */
  12. public class Main2 {
  13.    
  14.     public static void main(String[] args) {
  15.         // try-with-resource
  16.         // 1)
  17.         MyResource res = new MyResource();
  18.         // 2)
  19.         try(MyResource res2 = new MyResource();
  20.                 MyResource res3 = new MyResource();){
  21.             System.out.println("do something with " + res2);
  22.         }catch(Exception exc){
  23.             exc.printStackTrace();
  24.         }        
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement