|
-
Is there any way to start thread with out extending Thread class and implementing Run
Is there any way to start a thread without extending class Thread and implementing Runnable interface.
For eg. Consider the code below:
class Daemon
{
public static void main(String arg[])
{
String s="thead";
Thread t = new Thread();
t.setName(s);
//t.start();
}
public void run()
{
System.out.println("in run of main");
System.out.println("t thread exiting");
}
}
The code above neither extends Thread class or nor implements Runnable interface, even then i am able to create a thread but when i call start() method
the run() is not getting called as i haven't provided the target.
Is there any way to get this work without using Runnable or Extending Thread?
Similar Threads
-
Replies: 6
Last Post: 03-15-2006, 07:06 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks