User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 397,758 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,464 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Feb 8th, 2008
Views: 2,089
Hi this is a very simple program explaining of Threads using the runnable interface. I hope this will help in some other way. email me at: sri_jes@yahoo.co.in
java Syntax | 3 stars
  1. public class ThreadTester
  2. {
  3. public static void main(string args[])
  4. {
  5. Runnableex r=new Runnableex();
  6. Thread t=new Thread(e);
  7. t.start():
  8.  
  9. )
  10. }
  11.  
  12. class Runnableex implements Runnable
  13. {
  14. int i;
  15.  
  16. public void run()
  17. {
  18. i=0;
  19. while(true)
  20. {
  21. System.out.println("HELLO"+i++);
  22. if(i==50)
  23. {
  24. break;
  25. }
  26. }
  27. }
  28. }
Comments (Newest First)
finepax007 | Newbie Poster | Mar 8th, 2008
Runnableex r=new Runnableex();
Thread t=new Thread(r);
 t.start();
sri_jes13 | Newbie Poster | Feb 8th, 2008
thanks
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 3:46 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC