✅ Java Interview Questions (Company-
Wise)
1. TCS
Threads
1. Difference between process and thread.
2. Lifecycle of a thread in Java.
3. Difference between start() and run().
4. What is synchronization?
5. Difference between synchronized method and synchronized block.
6. Explain deadlock with an example.
7. Difference between wait() and sleep().
8. What is thread priority in Java?
9. Explain thread pooling in Java.
10. Difference between Runnable and Callable.
Interfaces
11. Difference between abstract class and interface.
12. Can an interface extend another interface?
13. Explain marker interface with examples.
14. What is a functional interface?
15. Can we define variables in an interface?
16. What are default methods in interface?
17. Can a class implement multiple interfaces?
18. Explain multiple inheritance problem in interfaces.
19. Difference between interface static methods and abstract methods.
20. Explain real-world use cases of interfaces in Java.
2. Infosys
Threads
1. How to create a thread by extending Thread class?
2. How to create a thread by implementing Runnable interface?
3. What is the difference between user threads and daemon threads?
4. What is a race condition?
5. How do you avoid deadlocks?
6. Difference between notify() and notifyAll().
7. What is the Executor framework?
8. Explain Future and CompletableFuture.
9. Can we restart a thread once it is dead?
10. Explain differences between single-threaded and multi-threaded applications.
Interfaces
11. What is an interface in Java?
12. Why does Java not support multiple inheritance with classes but supports it with
interfaces?
13. Can interfaces have constructors? Why or why not?
14. Difference between interface inheritance and class inheritance.
15. Explain SAM (Single Abstract Method).
16. What is the use of @FunctionalInterface annotation?
17. Can you override default methods from an interface?
18. Can an interface have private methods? (Java 9+)
19. Example of interface used in Java Collections Framework.
20. Difference between abstract class, interface, and enum.
3. Cognizant (CTS)
Threads
1. What are thread states?
2. Difference between concurrency and parallelism.
3. What is synchronized keyword?
4. Can we make a static synchronized method?
5. Explain thread communication.
6. What is ReentrantLock?
7. Explain difference between ThreadLocal and synchronized block.
8. How to stop a thread safely?
9. Explain producer-consumer problem using threads.
10. What is the role of volatile keyword in multi-threading?
Interfaces
11. Explain interface inheritance.
12. What is adapter class (related to interfaces)?
13. Can interface methods be final? Why?
14. Explain multiple interfaces implementation with example.
15. Can we declare a main method inside an interface?
16. Can an interface extend multiple interfaces?
17. What is the role of interfaces in Java API design?
18. Can interfaces contain nested types?
19. Explain difference between abstract methods in abstract class vs interface.
20. Example of functional interface with lambda expression.
4. Wipro
Threads
1. Define multithreading in Java.
2. Difference between multitasking and multithreading.
3. What is thread safety?
4. Explain synchronized vs concurrent collections.
5. Difference between yield() and join().
6. How to create a thread-safe singleton?
7. What is the use of ThreadGroup?
8. Explain deadlock detection techniques.
9. Explain fork/join framework.
10. How many ways can you create a thread in Java?
Interfaces
11. Can an interface have static methods?
12. Explain interface segregation principle.
13. Difference between pure abstract class and interface.
14. Can we use interface for constants?
15. What is diamond problem in multiple inheritance? How is it solved in Java?
16. Explain interface default methods with example.
17. Can interface methods be private? (Yes, from Java 9)
18. Can an interface extend a class?
19. Give real-time example of interface usage.
20. Difference between interface and abstract class w.r.t performance.
5. Accenture
Threads
1. What is thread synchronization?
2. Difference between synchronized keyword and ReentrantLock.
3. Explain thread starvation.
4. Explain livelock with example.
5. What is atomic operation in multithreading?
6. How to implement thread-safe collections?
7. What is the difference between concurrent package and synchronized blocks?
8. What is the use of CountDownLatch?
9. Explain CyclicBarrier.
10. Explain difference between thread-based multitasking and process-based
multitasking.
Interfaces
11. Can interfaces be empty? (Marker interfaces)
12. Difference between normal interface and functional interface.
13. Explain SAM with lambda usage.
14. What is the role of Comparator interface?
15. Can we implement multiple interfaces with same method signature?
16. Can interfaces declare protected methods?
17. What is the difference between extending interface and implementing interface?
18. Can interfaces have generic types?
19. How to resolve ambiguity in multiple interface default methods?
20. Interface usage in Java Streams API.