Java Interview Preparation
Java Interview Questions & Answers
Curated Core Java, JVM, Collections, Concurrency, Java 8, and Spring Boot interview questions with concise answers, code snippets, and follow-up points.
Answer:
JVM executes Java bytecode on a specific OS. JRE = JVM + core class libraries needed to run Java apps. JDK = JRE + development tools (javac, javadoc, jdb) needed to build Java apps.
Follow-up & Details: Follow-up: Is JVM platform independent? No—bytecode is platform-independent, while each OS has its own native JVM.
// Compiled with javac (JDK) -> Executed by java (JRE/JVM)
public class Main {
public static void main(String[] args) {
System.out.println(System.getProperty("java.vm.name"));
}
}Key Takeaways: JDK > JRE > JVM | WORA via Bytecode | JIT optimizes hot paths