Title: Java: Threads Post by: Khushi on January 03, 2007, 12:09:22 AM How to implement your own dynamic class threads, and run them.
simply copy the 2 code segments and replace the //thread code with your desired code to thread. //private Thread class: Code: private class ThreadMyProg implements Runnable{ //how to call this class and run it: Code: ThreadMyProg aThread = new ThreadMyProg(); /* this code is generated dynamically, but stores a single copy of the thread class to be re-used upon it's need, you can take this a step further and implement a stack to create multiple copies of this method, thus taking advantage of threads to the fullest.*/ |