Computer Science Canada

thread

Author:  matt271 [ Thu Jun 04, 2009 5:37 am ]
Post subject:  thread

is there anyway in java to load a class in a new thread.

so if u say Object blah = new Object(); then blah.doSomething(); itll run doSomething in a unique thread dedicated to Object ?

Author:  jbking [ Thu Jun 04, 2009 8:54 am ]
Post subject:  Re: thread

You can create a new thread and in it load a class, though that seems like a kind of simple answer. How familiar are you with threads and using the Thread class? Here are a few links that may help unless you are wanting to load a class in another thread and have both threads access the same item which may be a bit tricky but should be doable.

If the question is about the syntax of using threads, check out these few threads for some details on how to use them in Java:

Thread (Java 2 Platform SE v1.4.2
Introduction to Java threads
Java Threads
Creating a Thread

If you want something more advanced look at this:
Java Theory and Practice: Thread pools and work queues


: