N
N
nikesport2014-12-03 12:35:57
Java
nikesport, 2014-12-03 12:35:57

How do objects behave in multithreaded classes?

If a class A that extends Thread creates an object of a class that is not multi-threaded then the instruction of that class will be executed on the main thread or on the thread created by class A ?
class Main {
public static void main(args)
{
new A.start();
}
}
class A extends Thread {
public void run(){
OtherClass otherClass = new OtherClass()
}
}
class OtherClass {
//code in this thread will be
//executed in the thread created by class A
//or in the main thread ?
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vit, 2014-12-03
@fornit1917

in stream A.

E
edolganov, 2014-12-06
@edolganov

I recommend a very simple and visual article about threads:
skipy.ru/technics/synchronization.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question