网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  IT文章  >  try() catch{}

try() catch{}

分类: IT文章 • 2022-05-22 15:05:20
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(root, path))) {
  xxxxx  
}catch{
  xxxxx  
}

和平常见的不一样

这种情况的()中的代码一般放的是对资源的申请,如果{}中的代码出项了异常,()中的资源就会被关闭

对文件的操作比较常见。

相关推荐

  • try、catch、finally带return的执行顺序总结
  • HDU2717:Catch That Cow(BFS 队列)
  • you can try adding it manually...
  • 通过try、except和else的使用来使Python程序更加“强壮”
  • POJ 3278 Catch That Cow
  • try、catch、finally 块的关系
  • 错误处理try catch
  • 20141017--异常语句try-catch
  • POJ 1703 Find them,Catch them ----种类并查集(经典)
  • Catch That Cow(广度优先搜索)
  • SpringCloud-Hystrix Dashboard 之 Unable to connect to Command Metric Stream
  • springboot基于方法级别注解事务的多数据源切换问题
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号