What is the purpose of `wait()` and `notify()` in Java synchronization?
`wait()` makes a thread enter into an infinite loop, and `notify()` resumes it immediately.
Thatâ€™s incorrect. `wait()` causes the thread to release the lock and wait for a signal, not enter an infinite loop.
Can you explain the correct behavior of `wait()` and `notify()` in terms of thread communication?