Thursday, 25 July 2019

Multithreading Interview Q&A

What is a Thread and What is the need for threads in Java?
What is the difference between a process and a Thread?
Which Thread by default runs in every java program?
How do you create a thread?
How do you create a thread by extending thread class?
How do you create a thread by implementing runnable interface?
How do you run a thread in Java?
What are the different states of a thread?
What is priority of a thread? What is the default priority of the Thread? How do you change the priority of a thread?
What is executorservice?
Can you give an example for executorservice?
Explain different ways of creating executor services .
How do you check whether an executionservice task executed successfully?
What is callable? How do you execute a callable from executionservice?
What is synchronization of threads?
Can you give an example of a synchronized block?
Can a static method be synchronized?
What is the use of join method in threads?
Describe a few other important methods in threads?
What is a deadlock? How can you resolve deadlock situation?
What are the important methods in Java for inter-thread communication?
What is the use of wait method?
What is the use of notify method?
What is the use of notifyall method?
Can you write a synchronized program with wait and notify methods?
How can you stop a Thread which is running?
Explain the two types of multitasking?
What is Thread scheduler?
Explain the life cycle of a Thread?
What is daemon Thread?
Cont..

Thanks..!!