Yes, but the special thing about wait is that the CPU is not being fully utilized to perform that task, where as an infinite while/for loop is maxing out your CPU. I still think it's kind of weird......
Type: Posts; User: helloworld922
Yes, but the special thing about wait is that the CPU is not being fully utilized to perform that task, where as an infinite while/for loop is maxing out your CPU. I still think it's kind of weird......
Maybe you should take a look at this:
Synchronized Statements
The only thing I can think of is that wait causes the current thread to wait until o.notify() or o.notifyAll() are called. However,...
hmm... I'm not so good with multi-threaded code, but I think it creates an Object o, then tells o to wait until it's been notified. The synchronized means that only one thread has access to it's guts...