File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,9 +87,15 @@ stop(executor);
8787
8888
8989#### 11. What are differences between wait and sleep method in java?
90- wait release the lock or monitor while sleep doesn't release any lock or monitor while waiting.
91- Wait is used for inter-thread communication while sleep is used to introduce pause on execution.
92- 在` java.lang.Thread ` 类中,提供了` sleep() ` ,而` java.lang.Object ` 类中提供了` wait() ` ,sleep need try catch
90+ - ` wait() `
91+ - release the lock or monitor
92+ - wait is used for inter-thread communication
93+ - 在`java.lang.Thread`类中,提供了`sleep()`
94+ - ` sleep() `
95+ - doesn't release any lock or monitor while waiting
96+ - leep is used to introduce pause on execution.
97+ - ` java.lang.Object ` 类中提供了` wait() `
98+ - sleep need try catch interruption
9399
94100#### 12. What is difference between CyclicBarriar and CountdownLatch in Java ?
95101One difference is that you can reuse CyclicBarrier once barrier is broken but you can not reuse ContdownLatch.
You can’t perform that action at this time.
0 commit comments