Java exception handling

后端 未结 7 1283
無奈伤痛
無奈伤痛 2020-12-02 00:37

How do I use exceptions and exception handling to make my program continue even if an exception occurs while processing certain files in a set of files?

I want my pr

7条回答
  •  悲哀的现实
    2020-12-02 01:17

    for(File f : files){
       try {
           process(f); // may throw various exceptions
       } catch (Exception e) {
           logger.error(e.getMessage(), e);
       }
    }
    

提交回复
热议问题