Can a thread be a member of another thread?

Answer Posted / s.ramesh

import java.util.*;

public class DemoThread extends Thread {

private Thread t = null;

public DemoThread() {
t= new Thread(this, "RacingThread");
t.start();
}

public static void main(String[] args) {
DemoThread dt = new DemoThread();
dt.setName("DemoThread");
dt.start();
}
public void run()
{
while(true)
{
try
{
this.sleep(5000);
}
catch(Exception e)
{
System.out.println("Exception Occured");
}
}
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you need to set-up a cluster with jboss?

683


What is permgen or permanent generation?

667


What is ioc concept?

788


What are the types of scaling?

658


Can you give me a simple example of using the requiredif validator rule?

713






when A client sent a request to the server to open facebook page and close the browser after this request .at that time the same user do login by using a different browser then that session id will exist or not for the same client??

1199


which type of objects reference will be given to client?

2135


Explain the difference between object state and behavior?

653


What is an abstract method?

677


If your ui seems to freeze periodically, what might be a likely reason?

654


Which container method is used to cause a container to be laid out and redisplayed?

748


Describe responsibilities of Activator?

1761


How messaging services are done, before release of JMS?

1680


How would you create a button with rounded edges?

644


Why are my checkboxes not being set from on to off?

748