100 imp interview questions for Java developers
04.04.2025
0 views
Core Java
- What is the difference between
==
and .equals()
in Java?
- Explain the concept of immutability in Java.
- What is the purpose of the
final
keyword in Java?
- How does Java achieve platform independence?
- What is the difference between
String
, StringBuilder
, and StringBuffer
?
- Explain the concept of method overloading and overriding.
- What is the use of the
super
keyword in Java?
- How do you handle exceptions in Java? Explain
try-catch-finally
.
- What is the difference between
checked
and unchecked
exceptions?
- What is the purpose of the
static
keyword in Java?
- Can you overload the
main
method in Java? If yes, how?
- What is the difference between
ArrayList
and LinkedList
?
- How does Java garbage collection work?
- What is the difference between
HashMap
and Hashtable
?
- Explain the concept of multithreading in Java.
- What are the different ways to create threads in Java?
- What is the difference between
sleep()
and wait()
?
- What is the purpose of the
volatile
keyword?
- How does Java support encapsulation?
- What is the difference between an abstract class and an interface?
- Can we instantiate an abstract class? Why or why not?
- What is the difference between
compareTo()
and compare()
?
- What is autoboxing and unboxing in Java?
- What is the difference between
transient
and volatile
keywords?
- What is the purpose of the
Object
class in Java?
Collections Framework
- What is the difference between
List
, Set
, and Map
?
- How does
HashSet
ensure uniqueness of elements?
- What is the time complexity of operations in
ArrayList
vs LinkedList
?
- What is the difference between
Iterator
and ListIterator
?
- How does
TreeSet
maintain sorting order?
- What happens if we add a
null
value to a HashMap
?
- What is the difference between
poll()
and remove()
in Queue
?
- Explain the working of
ConcurrentHashMap
.
- What is the difference between
fail-fast
and fail-safe
iterators?
- How does
PriorityQueue
work?
- What is the difference between
Comparable
and Comparator
?
- What is the purpose of the
retainAll()
method in collections?
- How does
Vector
differ from ArrayList
?
- What is the difference between
keySet()
and entrySet()
in Map
?
- How do you sort a
List
of custom objects?
Java 8 Features
- What are lambda expressions in Java?
- What is a functional interface? Give examples.
- What is the difference between
forEach
and for-loop
?
- Explain the concept of streams in Java.
- What is the difference between
map()
and flatMap()
?
- What are default methods in interfaces?
- What is the purpose of the
Optional
class?
- How does
Stream.collect()
work?
- What are method references in Java?
- What is the difference between intermediate and terminal operations in streams?
OOPs Concepts
- What is polymorphism? Explain its types.
- What is inheritance? What are its advantages and disadvantages?
- What is the difference between composition and aggregation?
- What is the diamond problem in Java? How is it resolved?
- What is the difference between
this
and super
?
- What is the difference between
abstract
classes and interfaces in Java 8+?
- What is encapsulation? Why is it important?
- What is the difference between
private
, protected
, and public
access modifiers?
- What is the purpose of the
toString()
method?
- What is the difference between
instanceof
and isInstance()
?
Advanced Java
- What is the difference between
JVM
, JRE
, and JDK
?
- What is reflection in Java? Provide an example.
- What is the purpose of annotations in Java?
- What is the difference between
ClassNotFoundException
and NoClassDefFoundError
?
- What is the difference between
String pool
and heap memory?
- What is the purpose of the
ClassLoader
in Java?
- What is the difference between
serializable
and externalizable
?
- What is the purpose of the
clone()
method?
- What is the difference between shallow copy and deep copy?
- What is the purpose of the
finalize()
method?
Concurrency and Multithreading
- What is the difference between
Runnable
and Callable
?
- What is the purpose of the
ExecutorService
?
- What is thread pooling? Why is it used?
- What is the difference between
synchronized
and ReentrantLock
?
- What is the difference between
start()
and run()
methods in threads?
- What is thread starvation? How can it be avoided?
- What is a deadlock? How can it be prevented?
- What is the purpose of
ThreadLocal
?
- What is the difference between
notify()
and notifyAll()
?
- What is the purpose of the
ForkJoinPool
?
Spring Framework (if applicable)
- What is dependency injection? How does Spring implement it?
- What is the difference between
@Autowired
and @Qualifier
?
- What is the difference between
@Component
, @Service
, and @Repository
?
- What is the purpose of the
@Transactional
annotation?
- What is Spring Boot? How is it different from Spring Framework?
- What is the purpose of the
application.properties
file?
- What is the difference between
singleton
and prototype
scopes in Spring?
- What is AOP (Aspect-Oriented Programming)?
- What is the difference between
@Controller
and @RestController
?
- What is the purpose of the
DispatcherServlet
?
Hibernate (if applicable)
- What is the difference between
get()
and load()
in Hibernate?
- What is lazy loading? How does it work?
- What is the purpose of the
SessionFactory
in Hibernate?
- What are the different states of an entity in Hibernate?
- What is the difference between
save()
and persist()
?
- What is the purpose of the
@Entity
annotation?
- What is HQL (Hibernate Query Language)?
- What is the difference between
merge()
and update()
?
- What is the second-level cache in Hibernate?
- What is the purpose of the
@Transactional
annotation in Hibernate?
Comments ()
Please
login to leave a comment