This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread - suspend()
 
Similar Threads
Thread functioning help
thread doubt
Thread Problem
Thread(suspend(), resume())
Thread doubt