Java Interview Questions
Java Interview Questions
Questions
Made by: Want More?
Join Telegram
DEVELOPERS
Tap here
<SOCIETY/> or Search on Telegram
1. What is inheritance?
Inheritance is a mechanism where one class acquires the
properties (fields) and behaviors (methods) of another
class. It provides code reusability and method overriding.
DEVELOPERS
A package is a namespace that organizes a set of related
classes and interfaces. The java.lang package is imported
by default.
<SOCIETY/>
== checks for reference equality, whereas .equals() checks
for value equality.
6. What is a static method?
A static method belongs to the class rather than an
instance of the class. It can be called without creating an
object of the class.
DEVELOPERS
11. What is the difference between StringBuilder and
StringBuffer?
Both are used for creating mutable strings. StringBuilder
is not synchronized and is faster, whereas StringBuffer is
<SOCIETY/>
synchronized and thread-safe.
DEVELOPERS
== checks if two references point to the same
object. instanceof checks if an object is an instance
of a specific class or subclass.
<SOCIETY/>
volatile is used to indicate that a variable's value will be
modified by different threads
DEVELOPERS
26. What is the difference between wait() and sleep()
methods in Java?
wait() is used for thread communication and releases the
lock on the object, while sleep() is used to pause the
<SOCIETY/>
thread for a specified period without releasing the lock.
DEVELOPERS
implemented right in the body of a method.
<SOCIETY/>
reference types.
DEVELOPERS
for Java, providing a framework for mapping an object-
oriented domain model to a relational database.
<SOCIETY/>
hashCode() returns an integer value, generated by a
hashing algorithm. It is used for hashing in data
structures like HashMap.
DEVELOPERS
not prevent the JVM from exiting when the program
finishes but still runs. Daemon threads are used for
background supporting tasks.
<SOCIETY/>
More E-Books Coming soon!
Join our Community to Stay Updated
Follow us on Instagram
@Developers_Society
Tap here to follow
Join Join
WhatsApp Group Telegram Channel
FOR DAILY UPDATES EXCLUSIVE CONTENT