这是一个创建于 4163 天前的主题,其中的信息可能已经有所发展或是发生改变。
  public class sleep {
 public static void main(String[] args) {
 try {
 Thread.sleep(200);
 } catch (InterruptedException e) {}
 System.out.println("Time out");
 }
}
这个 
 System.out.println("Time out");
为何不能放到上面catch的大括号里面?
        3 条回复    2014-06-08 22:08:10 +08:00      |  |  |      1hazard      2014-06-08 14:56:58 +08:00 额。。。明白了。。。 | 
 
      |  |  |      2shoumu      2014-06-08 14:57:47 +08:00  1 也可以啊,放里面的话在捕捉到异常的时候才执行System.out.println("Time out");了
 另:推荐用gist贴代码
 | 
 
      |  |  |      3terrens      2014-06-08 22:08:10 +08:00  1 InterruptedException是给线程被中断例外用的。 |