Alex S
Posts: 27
Nickname: andu
Registered: Mar, 2003
|
|
Re: Understanding of Threads in Java
|
Posted: Mar 10, 2003 2:31 AM
|
|
Every thread starts when you call start() method. This method will call run() method.
So, you have to override the Thread's run() method, put there your thread functionality and then call start() method to start the thread. By the way, if you put code like "while(true)..." in your constructor, I guess your object will never be created.
Pay attention to syncronization if you will share resources (variables, objects etc) between two or more threads.
If you want to learn java threads, read Thread and Runnable java api documentation and thread tutorial from java tutorial (check on http://java.sun.com site).
|
|