Can a thread be a member of another thread?
Answers were Sorted based on User's Feedback
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 |
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 |
what are the advantages of JTA over JTS?
Why are some of the class and element names counter-intuitive?
Hi I have joined java course. I also want additional help from any tutorials website. Please suggest me tutorials which provides easy to understand online applet tutorials?
What modifiers may be used with an inner class that is a member of an outer class?
what is difference between object state and behaviour?
what is heepStored?
How do you iterate in Hashmap?
what is default length of textfield ?
What are the diff types of exception?
What is the difference between the font and fontmetrics classes?
Why is actionform a base class rather than an interface?
What are local interfaces? Describe.