Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.app11;
- /**
- *
- * @author Admin
- */
- public class Main2 {
- public static void main(String[] args) {
- // try-with-resource
- // 1)
- MyResource res = new MyResource();
- // 2)
- try(MyResource res2 = new MyResource();
- MyResource res3 = new MyResource();){
- System.out.println("do something with " + res2);
- }catch(Exception exc){
- exc.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement