This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Threads" Watch "Threads" New topic


Vrishal Likhite

Joined: Nov 21, 2005
Posts: 18
hello everyone
i am having two Thead objects declared as bellow
final Thread t1=new Thread(new Runnable()
public void run(){}
final Thread t2=new Thread(new Runnable()
public void run(){

wat i m facing is the thread t1 is not getting started from within t2
if i want to do so wats the way out? y is this code not working

Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
How do you say it is not started.

Also, you are trying to start the same thread twice, obviously that won't work?

ASCII silly question, Get a silly ANSI.
marc weber

Joined: Aug 31, 2004
Posts: 11343

As Stuart pointed out, you are trying to call start twice on the same thread, and you can't do that.

But you can pass the same instance of Runnable to a new thread...

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Vrishal Likhite

Joined: Nov 21, 2005
Posts: 18
Hey marc thanx for ur reply
the code u sent might just prove helpfull to me in my work
I agree. Here's the link:
subject: Threads
It's not a secret anymore!