Difference between JDK, JRE and JVM
Three names that look similar — JVM, JRE, JDK. Freshers mix them. Learn them as three boxes, one inside the other.
JVM (Java Virtual Machine) is the engine. It reads bytecode and runs your program. Without JVM, a .class file does nothing.
JRE (Java Runtime Environment) is JVM plus the libraries needed to run a ready app. If you only want to run a Java program, JRE is enough.
JDK (Java Development Kit) is JRE plus tools for writing code — mainly javac (compiler). If you write programs in college, you install JDK, not only JRE.
Picture — JDK contains JRE. JRE contains JVM. Developer → JDK. Only run apps → JRE. Engine inside → JVM.
Let's take this on the board with one tiny Main class — no extra files. Difference between JDK, JRE and JVM — output: JVM → runs bytecode / JRE → JVM + libraries / JDK → JRE + javac/tools. Say that nesting in the viva. Start from main, go line by line, and stop at each print. That output is the proof for Difference between JDK, JRE and JVM.
JDK (write + compile)
javac + tools
JRE (run apps)
libraries
JVM (run bytecode)Draw JDK > JRE > JVM. One line each.