자원 클래스에 use {@code try} - with-resources constructions 작성

442 단어 Java 기반
  @Test
    public  void cloneTest() {
        /**use {@code try}-with-resources constructions**/
        try(ObjAutoCloneable lock =new ObjAutoCloneable()){
            //  
        }catch (Exception e){

        }
    }
    
    class  ObjAutoCloneable implements AutoCloseable{

        @Override
        public void close() throws Exception {
            System.out.println("           ");
        }
    }

좋은 웹페이지 즐겨찾기