wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread - suspend() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread - suspend()" Watch "Thread - suspend()" New topic
Author

Thread - suspend()

Deepti Dixit
Greenhorn

Joined: Dec 27, 2001
Posts: 17
Why should the following code even complile ? Isn't suspend() supposed to be called by some other thread on the current thread ?
It prints "Test" and hangs there!
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by Deepti Dixit:
Why should the following code even complile ? Isn't suspend() supposed to be called by some other thread on the current thread ?
It prints "Test" and hangs there!


Well first of all suspend and resume are deprecated & yes you are right that other threads should call suspend, in this context the thread itself is calling suspend and there is no other thread which you have created which will resume the thread which is suspended. There is no reason to get compiler error, the code is perfectly ok and passes the compiler check.
 
wood burning stoves
 
subject: Thread - suspend()
 
Similar Threads
Thread(suspend(), resume())
thread doubt
Thread doubt
Thread Problem
Thread functioning help