- One of most asked topic and most confusing one too. So, here is the complete list of questions and answers to learn and understand multithreading.
- What is the difference between Process and Thread?
- What is difference between user Thread and daemon Thread?
- How can we create a Thread in Java?
- What are different states in lifecycle of Thread?
- Can we call run() method of a Thread class?
- How can we pause the execution of a Thread for specific time?
- What do you understand about Thread Priority?
- What is context-switching in multi-threading?
- How can we make sure main() is the last thread to finish in Java Program?
- How does thread communicate with each other?
- Why thread communication methods wait(), notify() and notifyAll() are in Object class?
- Why wait(), notify() and notifyAll() methods have to be called from synchronized method or block?
- Why Thread sleep() and yield() methods are static?
- How can we achieve thread safety in Java?
- What is volatile keyword in Java
- Which is more preferred - Synchronized method or Synchronized block?
- How to create daemon thread in Java?
- What is Thread Group? Why it’s advised not to use it?
- What is Deadlock? How to analyze and avoid deadlock situation?
- What is Java Timer Class? How to schedule a task to run after specific interval?
- What is Thread Pool? How can we create Thread Pool in Java?
- What will happen if we don’t override Thread class run() method?
- What is the need for threads in Java?
- 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? 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?
- 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?