PDA

Click to See Complete Forum and Search --> : multithreading problem


haris-raheem
Jul 5th, 2001, 06:47 AM
can anyone tell me that how run method is called from start method of
thread class. i dont want code but only reason

Dillinger4
Jul 6th, 2001, 12:48 PM
Either implement a Runnable interface or subclas thread to use it's run() method.

Your quesiton really dosnt have an answer besides it just is. If you think about it though it makes sense. When you start somthing, you are in the process of begining to run it.

VirtuallyVB
Jul 6th, 2001, 02:03 PM
The Thread class "knows" about the run() method in a class that either implements Runnable (a reference is passed in the constructor) or extends Thread. So it would be the same as your own method "A()" calling another one of your own methods "B()".

Strictly speaking, you can call run() just as any other method, but to have it run as its own thread, invoke it by start(). (This can be a question on the Exam-- and watch for run(something); that does NOT implement the Runnable interface--run() does.)