This content has been marked as final. Show 2 replies
The run() method is what will run in parallel when you call start() on the thread (also you should rather implement Runnable than extend Thread). If you call any other method in any class from run() they will be run parallel to any other threads.
Methods and classes are independent from threads of execution.
Well, it's probably not so clear because, strictly speaking, methods do not run in parallel. When one Thread (Thread A) starts another Thread (Thread B) via the "Thread.start" method, the first method called by "B" is it's "run" method. Thread A continues to run in parallel. Now, if you implement Thread B's run method to invoke another method, on any object, that method will be running in Thread B's execution environment, regardless of where the method is defined - even if the method is defined in the "A" class.
By the way, you would not need to extend Thread and implement Runnable. You should just be implementing Runnable and creating a new Thread by passing in the Runnable instance.