Multithreading Interview Questions in Java


Prev Tutorial Next Tutorial

Interview Questions on Multithreading in Java

What is thread ?

Thread is a lightweight components and it is a flow of control. In other words a flow of control is known as thread.

What is multithreading ?

Multithreading in java is a process of executing multiple threads simultaneously.

Explaining State or Life cycle of thread.

State of a thread are classified into five types they are

  • New State
  • Ready State
  • Running State
  • Waiting State
  • Halted or dead State

How to achieve multithreading in java ?

In java language multithreading can be achieve in two different ways.

  • Using thread class
  • Using Runnable interface

Difference between Process and Thread ?

Process is a program in execution whereas thread is a separate path of execution in a program.

In which state no memory is available for thread ?

If the thread is in new or dead state no memory is available but sufficient memory is available if that is in ready or running or waiting state.

Difference between sleep() and suspend() ?

Sleep() can be used to convert running state to waiting state and automatically thread convert from waiting state to running state once the given time period is completed. Where as suspend() can be used to convert running state thread to waiting state but it will never return back to running state automatically.

What is a Deadlock ?

When two threads are waiting each other and can't precede the program is said to be deadlock.

Difference between Serialization and Deserialization ?

Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.

What is Thread Synchronization ?

Allowing only one thread at a time to utilized the same resource out of multiple threads is known as thread synchronization or thread safe.

Difference between yield() and sleeping()?

When a task invokes yield(), it changes from running state to runnable state. When a task invokes sleep(), it changes from running state to waiting/sleeping state.

What is a daemon thread ?

These are threads that normally run at a low priority and provide a basic service to a program or programs when activity on a machine is reduced. garbage collector thread is daemon thread.

Why use Thread Synchronization ?

Whenever multiple threads are trying to use same resource than they may be chance to of getting wrong output, to overcome this problem thread synchronization can be used.

How to achieve Thread Synchronization in java ?

In java language thread synchronization can be achieve in two different ways.

  • Synchronized block
  • Synchronized method

How to achieve multiple inheritance in java ?

Using Interface concept you can achieve multiple inheritance in java.

Difference between suspend() and stop() ?

Suspend method is used to suspend thread which can be restarted by using resume() method. stop() is used to stop the thread, it cannot be restarted again.

Prev Tutorial Next Tutorial


Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: or 9999595223

wifi cctv camera

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements

Buy Websites 9999595223
wifi cctv camera

Wifi CCTV Camera RS:1200 to 2499.

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: or 9999595223 Try this Keyword C++ Programs