- What is the difference between JDK, JRE, and JVM?
Answer:
JVM (Java Virtual Machine):
JVM is responsible for running Java bytecode and converting it into machine code so programs can execute on any system.
JRE (Java Runtime Environment):
JRE provides the environment required to run Java programs. It includes JVM + libraries.
JDK (Java Development Kit):
JDK is used for developing Java applications. It includes JRE + development tools like compiler (javac).
π In short:
JDK β For Development
JRE β For Running Java
JVM β Executes Java bytecode.
- What are the main OOP concepts in Java?
Answer:
Java is based on Object-Oriented Programming. The four main principles are:
- Encapsulation β Wrapping data and methods together in a class.
- Inheritance β One class can acquire properties of another class.
- Polymorphism β One method behaves differently in different situations.
- Abstraction β Hiding implementation details and showing only functionality.
These concepts help in writing reusable, scalable, and maintainable code.
- Why is Java Platform Independent?
Answer:
Java is platform independent because Java code is compiled into bytecode, which can run on any system that has a JVM installed.
Flow:
Java Code β Bytecode β JVM β Machine Code
Thatβs why Java follows the concept:
"Write Once, Run Anywhere."
- What is the difference between == and .equals() in Java?
Answer:
==
Compares memory addresses (reference comparison).
.equals()
Compares actual content or values of objects.
Example:
String a = new String("Java");
String b = new String("Java");
System.out.println(a == b); // false
System.out.println(a.equals(b)); // true
In interviews, this question checks your understanding of object comparison.
- What is Exception Handling in Java?
Answer:
Exception Handling is a mechanism used to handle runtime errors so that the program does not crash.
It uses:
- try
- catch
- finally
- throw
- throws
Example:
try {
int a = 10 / 0;
} catch (ArithmeticException e) {
System.out.println("Error: Cannot divide by zero");
}
Java has two types of exceptions:
Checked Exceptions
Unchecked Exceptions.
Call To Action (CTA)
If you want to learn Java from beginner to advanced, including exercises, interview questions, and MCQs:
π https://www.quipoin.com/tutorial/java
Start building your Java developer career today π

Top comments (0)