hi all,
i could not understand the following exam watch from threads chapter:
There is nothing special about run() method as far as
Java is concerned.Like main(), it just happens to be the name( and signature) of the method that the new
thread knows to invoke.So if you see code that calls the run() method on a Runnable(or on a Thread instance), it is perfectly legal.But it does not mean that the run() method will run in a separate thread!Calling a run() method just means you are invoking a method from whatever thread is currently executing, and the run method goes onto the current call stack rather than at the beginning of the new call stack.The following thread does not start a new thread of execution:
Runnable a = new Runnable();
a.run()//legal, but does not start a separate thread
please explain the above and also let me know how can this:
Runnable a = new Runnable();
be legal. As far as i know the interfaces are abstract and that is why can not be instantiated.
i am confused