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

What do you need to set-up a cluster with jboss?

1062


difference between  ejb,struts,hibernate,spring and jsp

2840


What are the services in RMI ?

2335


What is the difference between system.out ,system.err and system.in?

1085


What is scalable, portability in the view of J2EE?

2513


When is the best time to validate input?

1094


When a thread blocks on i/o, what state does it enter?

1079


hi friends, i have done my BE(CSE)at 2011 then i have joined one company before they asked me 50k so i paid but now they telling no project here so we r going to close like that so now i need any job i have good knowledge in core java and j2ee(jsp,servlet,jdbc) so if u know any job pl help me

2203


What is a session? Can you share a session object between different theads?

967


In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?

2082


What modifiers may be used with an inner class that is a member of an outer class?

1051


Can I import same package/class twice? Will the jvm load the package twice at runtime?

1128


What’s jboss cache in short?

1098


Name the eight primitive java types.

1107


Can I map more than one table in a cmp?

1063