Skip to content

Java Interview Q&A

Essential questions for students and aspiring Java developers.

1. What is the difference between JDK, JRE, and JVM?

  • JVM (Java Virtual Machine): The engine that runs the bytecode.
  • JRE (Java Runtime Environment): Includes JVM + libraries needed to run Java apps.
  • JDK (Java Development Kit): Includes JRE + development tools (compiler, debugger).

2. Why is Java platform independent?

Because it doesn't compile to machine code directly. It compiles to Bytecode, which can run on any platform that has a JVM.

3. What is the difference between == and .equals()?

  • ==: Compares the memory address (reference) of two objects.
  • .equals(): Compares the content (value) of two objects.

4. Can we overload the main() method?

Yes, we can have multiple methods named main with different parameters. However, the JVM will only call the one with the standard String[] args signature.

5. What is the difference between Final, Finally, and Finalize?

  • final: Keyword to make a variable constant, a class non-inheritable, or a method non-overridable.
  • finally: Block in exception handling that always executes.
  • finalize: Method called by the Garbage Collector before destroying an object.

Industry Tip

Interviewers love asking about Memory Management and Multithreading. Be sure to review those sections before your next technical round!