Java Multi-Threading Question:

Download Job Interview Questions and Answers PDF

Explain Thread?

Java Multi-Threading Interview Question
Java Multi-Threading Interview Question

Answer:

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.

Download Java Multi-Threading Interview Questions And Answers PDF

Previous QuestionNext Question
What is starvation?Explain some ways in which a thread can enter the waiting state?