Re: [J2SE] 請問delay的方法
自己包成 RuntimeException 之後呼叫這個方法就不用到處加 try catch。
public class ThreadUtils {
public static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.247.13
推
10/04 13:39, , 1F
10/04 13:39, 1F
→
10/04 14:43, , 2F
10/04 14:43, 2F
→
10/04 15:33, , 3F
10/04 15:33, 3F
→
10/04 15:36, , 4F
10/04 15:36, 4F
推
10/04 17:02, , 5F
10/04 17:02, 5F
推
10/04 20:30, , 6F
10/04 20:30, 6F
→
10/04 20:36, , 7F
10/04 20:36, 7F
→
10/04 23:27, , 8F
10/04 23:27, 8F
推
10/04 23:51, , 9F
10/04 23:51, 9F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 6 之 12 篇):