Firefox
Firefox

Reputation: 951

Call stack info on new thread in Java

When we invoke the start() then a new thread of execution starts with dedicated call stack.

I'm wondering which is going to be the first method in that call stack: start() or run().

It's mentioned that the Thread is considered to be dead once run() completes.

Upvotes: 0

Views: 907

Answers (2)

Tudor
Tudor

Reputation: 62469

start is a method call on the main thread. This means it is on the stack of the main thread. Then inside start a new thread is actually fired and the run method is the first method on the new thread's stack.

Upvotes: 3

SLaks
SLaks

Reputation: 888185

start() isn't called on the new thread at all; it only runs on the original thread.

Upvotes: 2

Related Questions