What does start() function do in multithreading in Java? - GeeksforGeeks
We have discussed that Java threads are typically created using one of the two methods : (1) Extending thread class. (2) Implementing Runnable
In both the approaches, we override the run() function, but we start a thread by calling the start() function. So why don't we directly call the oveerridden run() function? Why always the start function is called to execute a thread?
What happens when a function is called?
When a function is called the following operations take place:
- The arguments are evaluated.
- A new stack frame is pushed into the call stack.
- Parameters are initialized.
- Method body is executed.
- Value is retured and current stack frame is popped from the call stack.
Read full article from What does start() function do in multithreading in Java? - GeeksforGeeks
No comments:
Post a Comment