Java Threads & Concurrency Interview Questions

    Question 1: JAVA - Thread Creation

    Which of the following is a correct way to create a thread in Java?

    Question 2: JAVA - Start vs Run

    What happens if you call the run() method directly instead of start() on a thread?

    Question 3: JAVA - Runnable Example

    What will this code print?

    class MyTask implements Runnable { public void run() { System.out.println("Task executed"); } } public class Test { public static void main(String[] args) { Thread t = new Thread(new MyTask()); t.start(); } }

    Question 4: JAVA - Sleep Method

    What does Thread.sleep(1000) do?

    Question 5: JAVA - Synchronization

    Why is synchronization used in multithreading?

    Question 6: JAVA - Deadlock Example

    What is a deadlock?

    Question 7: JAVA - Executor Framework

    Which class provides factory methods for creating thread pools?

    Question 8: JAVA - Callable vs Runnable

    Which is true about Callable vs Runnable?

    Question 9: JAVA - Volatile Keyword

    What does the volatile keyword ensure in Java?

    Question 10: JAVA - ReentrantLock Example

    Which advantage does ReentrantLock have over synchronized?