摘要:
1、join 方法详解 1.1 为什么需要 join? 下面的代码执行,打印 r 是什么? static int r = 0; public static void main(String[] args) throws InterruptedException { test1(); } privat 阅读全文
posted @ 2023-06-01 22:43
|旧市拾荒|
阅读(283)
评论(0)
推荐(0)
摘要:
1、sleep 实现 在没有利用 cpu 来计算时,不要让 while(true) 空转浪费 cpu,这时可以使用 yield 或 sleep 来让出 cpu 的使用权给其他程序 while(true) { try { Thread.sleep(50); } catch (InterruptedEx 阅读全文
posted @ 2023-06-01 22:39
|旧市拾荒|
阅读(173)
评论(0)
推荐(0)

浙公网安备 33010602011771号