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

Is infobus easy to use?

0 Answers  


What are the different methods of identifying an object?

0 Answers  


What is the difference between the string and stringbuffer classes?

0 Answers  


Why a client should be multithreading? Explain.

0 Answers  


diff between jsp include directive and jsp action include?

4 Answers   SolutionNET,






What is RRL?

1 Answers  


How can I avoid validating a form before data is entered?

0 Answers  


Difference between hashmap and hashtable?

0 Answers  


What is private static final long serialVersionUID = 1L;

3 Answers   Google,


diff between jsp include directive and jsp action include?

2 Answers   SolutionNET,


difference between Abstract and Interface?

2 Answers   HCL, Infotech,


Can you control when passivation occurs?

0 Answers  


Categories