Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Explain phantom read?

2235


What are the diff types of exception?

1062


How substring() method of string class create memory leaks?

1048


Explain about thread synchronization inside a monitor?

2551


Where we can write Rmi registry in the code, without having to write it at the command prompt?

2771


What is glasgow?

1062


What is synchronization and why is it important?

1123


What class is used to create Server side object ?

2255


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

2486


Which characters may be used as the second character of an identifier, but not as the first character of an identifier?

1055


How are commas used in the intialization and iteration parts of a for statement?

1097


What is ioc concept & explain it?

1087


What are the difference between RMI and CORBA?

1118


Why is actionform a base class rather than an interface?

1070


What is message driven beam?

1073