Re: [J2SE] 請問delay的方法

看板java作者 (LetMeGoogleThatForYou)時間16年前 (2009/10/04 23:44), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串7/12 (看更多)
※ 引述《H45 (!H45)》之銘言: : 標題: Re: [J2SE] 請問delay的方法 : 時間: Sun Oct 4 13:00:25 2009 : : 自己包成 RuntimeException 之後呼叫這個方法就不用到處加 try catch。 : : 推 PsMonkey:這招倒是沒想過,我都乖乖包 try-catch XDXD 10/04 20:30 : → H45:當sleep太多的時候,這是讓程式碼稍微乾淨一點的小技巧 :D 10/04 20:36 : → AmosYang:public static main(String[] x) throws Throwable // XD 10/04 23:27 碎碎念一下 :) 在寫測試程式或 single-thread 程式時,這樣寫的確是簡潔又方便, 但在寫 multi-thread 程式時,可以參考這篇文章對 InterruptedException 的分析 ( google://InterruptedException ) Java theory and practice: Dealing with InterruptedException http://www.ibm.com/developerworks/java/library/j-jtp05236.html -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 65.87.177.87

10/05 09:43, , 1F
兩者可以並存,因為我還是有拋出例外,外面要不要catch都可以
10/05 09:43, 1F
文章代碼(AID): #1AoCBcO2 (java)
討論串 (同標題文章)
文章代碼(AID): #1AoCBcO2 (java)