📜  java try catch - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:28.453000             🧑  作者: Mango

代码示例2
try {
  // Code to try, which is throwing an Exception, e.g.
  /*example*/ Thread.sleep(100)
} catch (InterruptedException e /*Or any other exception*/) {
  // Handle Exception, usually:
  e.printStackTrace(); // Print the StackTrace of the exception to see what cause it
} finally {
  // Code executed after try / catch, used to close streams
  /*example*/ in.close();
}