Interviewer And Interviewee Guide

Java Multi-Threading Interview Question:

Explain Thread?

Submitted by: Administrator
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.
Submitted by: Administrator

Read Online Java Multi-Threading Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.