Answers

Question and Answer:

  Home  Java Multi-Threading

⟩ Explain Thread?

We can describe "thread" in two ways in Java.

1. An instance of class java.lang.Thread.

2. A thread of execution.

An instance of Thread is an object like all other objects in Java, it also has variables and methods and it lives and dies on the heap.

But a thread of execution is an individual light weight process that has its own call stack.

Even if you don't create any new threads in your program, threads are there running in background.

The main() method runs the main thread. So in main call stack the main() method would be the first.

When a new thread is created then it will have its own stack separate from the main() call stack.

 131 views

More Questions for you: