View Single Post
  #1 (permalink)  
Old 04-25-2007, 04:37 AM
sandor sandor is offline
Member
 
Join Date: Apr 2007
Location: Pennsylvania,USA
Posts: 46
sandor is on a distinguished road
threads question
I am trying to learn how to use threads to run a couple of methods repeatedly. This is my code and I get a compilation error when I try to run it. I am confused. help.
Code:
public void doA() { System.out.println("now I am doing A"); } public void doB() { System.out.println("now I am doing B"); } public void sleep() { System.out.println( " Zzzzzzz..."); } public void live() { new Thread() { public void run() { while (true) { doA(); doB(); sleep(); } } }.start(); }
Reply With Quote
Sponsored Links