Skip to content

Commit b26a857

Browse files
authored
Update interviewQuestions.md
1 parent 7e29e94 commit b26a857

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

interviewQuestions.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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 ?
95101
One difference is that you can reuse CyclicBarrier once barrier is broken but you can not reuse ContdownLatch.

0 commit comments

Comments
 (0)