This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I am trying to write a class that creates an object of another class. When I run my code, I expect to see a messagebox when the timer reaches the time passed in to the object, but it doesn't. I thought maybe it was because the program hit the end of the main method, so I threw in the thread to keep it executing, but it still didn't give me the message box. Can anyone tell me what I'm doing wrong? Thanks.
[ June 03, 2002: Message edited by: Dirk Schreckmann ]
You are creating a new thread, but you are not really doing anything with it. When you run your program, the main() method runs on one thread. If you want to start another thread and execute some code on that thread, you have to either extend a thread, override it's run method and put the code you want to execute on the separate thread in the run method and then call the Thread.start to execute the code. OR you can create an object that implements the runnable interface, provide a run method to this object and then create a thread with this object as an argument and then call the Thread.start to execute the code on a separate thread. HTH