Can a thread be a member of another thread?

Answers were Sorted based on User's Feedback



Can a thread be a member of another thread?..

Answer / 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

Can a thread be a member of another thread?..

Answer / amalendra

A thread is the smallest executable unit in the system. It
means a thread can start another thread, but it can not be
a member of another thread.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Advanced Java Interview Questions

What are the services in RMI ?

0 Answers  


which of the following authentication is stronger than the others? a. Http Basic b. Http DIGEST c. Form based

1 Answers  


What is the argument type of a programs main() method?

0 Answers  


Explain the purposes of methods wait(), notify(), notifyAll ()?

2 Answers  


Is it possible to stop the execution of a method before completion in a sessionbean?

0 Answers  






What are synchronized methods and synchronized statements?

2 Answers   Adobe,


What is the difference between long.class and long.type?

0 Answers  


When you will synchronize your code?

2 Answers  


Why does most servlets extend HttpServlet?

4 Answers   Accenture, Wipro,


Why do threads block on i/o?

0 Answers  


What is metaspace?

0 Answers  


In a multitiered application which tier is the browser in?

3 Answers   Adobe,


Categories