It's not a secret anymore!
The moose likes Threads and Synchronization and the fly likes thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "thread" Watch "thread" New topic


kamal vashist

Joined: Sep 13, 2006
Posts: 2
How can we create & start thread in one statement by implementing Runnable class .
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Do you know how to create an anonymous inner class?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Moving to our "Threads and Synchronization" forum.

[Jess in Action][AskingGoodQuestions]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
try the following

new Thread(new Runnable(){
//your code

Is that what you want

Rahul Bhattacharjee
LinkedIn - Blog
I agree. Here's the link:
subject: thread
It's not a secret anymore!