Java Threading Interview Questions and Answers

Java Threading Interview Questions and Answers

Java supports single-thread as well as multi-thread operations. A thread is a program’s path of execution. Most programs written today run as single thread, causing  problems s when multiple events or actions need to occur at the same time A single-thread program has a single entry point (the main () method) and a single exit point.

Threads can be created by using two different mechanisms:

Extending the Thread class

Implementing the Runnable Interface

What is Thread in Java?

What is difference between Process and Thread in Java?

How to implement Threads in Java?

Does Thread implement their own Stack, if yes how?

We should implement Runnable interface or extend Thread class. What are differences between implementing Runnable and extending Thread?

What are the differences between implementing Runnable interface and extending Thread class?

How can you say Thread behaviour is unpredictable?

When threads are not lightweight process in Java?

How can you ensure all threads that started from main must end in order in which they started and also main should end in last?

What is difference between starting thread with run() and start() method?

What is significance of using Volatile keyword?