Java Thread Interview Questions

What is a Thread.
Explain Thread Life Cycle.

Please read Threads

Methods in Thread Class

Please read Methods in Thread Class

When to use the Runnable interface Vs Thread class in Java?

Please read implements Runnable vs extends Thread

what are wait, notify and notifyAll methods?

please read wait, notify and notifyAll

Sleep vs Wait

Please read sleep vs wait

Difference between start() and run() method of thread class.

Answer:

Start() method creates a new thread and the code inside the run () method is executed in the new thread.
If we directly called the run() method then a new thread is not created and the currently executing thread will continue to execute the run() method.

Runnable vs Callable

Please read Runnable vs Callable

What is Deadlock and how to avoid DeadLock?

Please read Deadlock

What is ThreadGroup?

Please read ThreadGroup

What are ThreadLocal variables ?

Please read ThreadLocal

Leave a Reply

Your email address will not be published. Required fields are marked *