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

Difference between DurableSubscription and non- DurableSubscription?

1714


How would you create a button with rounded edges?

561


what is handle?

1856


what is an isolation level?

2215


Which javutil classes and interfaces support event handling?

584






A user of a web application sees a jsessionid argument in the URL whenever a resource is accessed. What does this mean? a. The form must have the field jsessionid b. URL rewriting is used as the session method c. Cookies are used for managing sessions

1814


Why a client should be multithreading? Explain.

594


What is the difference between a menuitem and a checkboxmenuitem?

585


What happens when a thread cannot acquire a lock on an object?

538


What are the purpose of introspection?

679


whats is mean by connectionpooling

1567


what is the use of State Factories?

1907


How primary key is implemented in Oracle?

1919


Why does the option tag render selected=selected instead of just selected?

674


What are the steps to write p-to-p model application?

1960