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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread" Watch "Thread" New topic


suren r

Joined: Sep 01, 2000
Posts: 7
Hi ,
I am new to Java programming,I need help from you guys..
I saw this question in mock exam and I though the answer is
"starting" and "done",but it's printing only"starrting"..where as if I replace yield()in place of suspend()it is printing both..
I remember reading some where suspended threads canbe restarted..
if that is the case why it is not printing both words..
Thanks in advance.....
here is the program
class demo1 extends Thread {
public void run( ) {
suspend( );
resume( );
public static void main(String args[ ]) {
demo1 tt = new demo1( );
tt.start( );
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
When your demo1 Thread executes suspend, it suspends itself.
There exists no running Thread to execute resume so it stays suspended indefinately.
Both suspend and resume are deprecated methods of Thread. You should not be using them because they can easily lead to deadlock situations.
I agree. Here's the link: http://aspose.com/file-tools
subject: Thread
It's not a secret anymore!