J
Java Basics Course
🔍
Question 4 • Pages 1–2

Difference B/W JDK, JRE and JVM

JDK (Java Development Kit) — Java program ko develop, compile (javac), debug aur run karne ke liye avashyak tools.Full kit with development tools (javac, debugger) + JRE to build and run Java apps.
JRE (Java Runtime Environment) — Java program chalane ke liye JVM + avashyak libraries aur runtime components deta hai.Provides JVM + core libraries and runtime components needed to run Java programs.
JVM (Java Virtual Machine) — Java ke bytecode ko execute karti hai, jisse Java program run hota hai.Executes Java bytecode (.class) so the Java program runs on the host machine.
Java Source Code.java
→
JDK Compilerjavac
→
Bytecode.class
→
JVMExecution
→
Program OutputResult
Question 5 • Page 2

What is Bytecode?

Bytecode ek intermediate code hai jise Java compiler source code ko compile karne ke baad generate karta hai.

Bytecode is an intermediate, platform-independent code generated by the Java compiler after compiling Java source code.

Jab hum Java program likhte hain, to uski file .java hoti hai. Compiler (javac) use compile karke .class file banata hai jisme bytecode hota hai. JVM is bytecode ko execute karti hai.
When we write a Java program, it is saved in a .java file. The compiler translates it into a .class file containing bytecode, which the JVM executes.
Question 6 • Page 2–3

Difference B/W a Compiler & an Interpreter

Compiler

Compiler source code ko execution se pehle dusri form ke code mein translate karta hai.

A compiler translates the entire source code into another form before execution begins.

Java mein javac compiler .java file ko compile karke .class file mein bytecode generate karta hai.
In Java, javac compiles the .java file and generates bytecode inside a .class file.

Interpreter

Interpreter runtime par instructions ko interpret karke execute karta hai.

An interpreter reads and executes instructions line-by-line at runtime.

Java mein JVM bytecode ko interpret kar sakti hai. Performance behtar karne ke liye JVM ka JIT (Just-In-Time) Compiler frequently executed code ko native machine code mein compile bhi kar sakta hai.
In Java, the JVM interprets bytecode at runtime, and its JIT (Just-In-Time) Compiler compiles frequently executed code into native machine code for better performance.