close(pstmt, conn);close(rs, pstmt, conn);private void close(AutoCloseable... acs){
for(AutoCloseable ac : acs){
try{
if(ac != null) ac.close();
}catch(Exception e){
throw new RuntimeException(e);
}
}
} ... : 가변인자. 매개변수로 몇개가 들어올 진 모르겠지만 그 속성들을 배열처럼 받아서 저장String sql = "select * from ?";
try(
Connection conn = ds.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
){
pstmt.setString(1, "db");
}catch{
throw new RuntimeException(e);
}