Core Java(Part-3)

Content

.Interpreter

.Compiler

.Assembler

.Datatypes

.JDK

.Identifier

.Interpreter

Interpreter = Wo banda jo line-by-line Java ko samjhata hai ki kya karna hai.
Jaise tumhara dost har step pe batata hai — “Ab yeh kar, ab yeh kar”

Interpreter = Java ka dost jo bolta hai:
‘Tension mat le bhai, main har line samjha ke chalata hoon.’

How java uses Interpreter:

Java have two things.

1.Compiler: It make the java code to (.class)bytecode.

2.Interpreter(JVM): The bytecode that it gets from the compiler it runs that code line by line.

Socho tumhe ek recipe mili hai French mein
Tumhe samajh nahi aati.
Tumhara ek dost (Interpreter) har step ko real-time translate karke bolta hai:

"Ab 1 spoon namak daal...
Ab gas on karo...
Ab pasta daalo..."

Bas waise hi Java ka Interpreter bytecode ko line-by-line JVM ko samjhaata hai, taaki program run ho.

Compiler

Compiler is java smart translator who translate the who code at a time.

Socho tumne ek pura recipe likha hai Hindi mein. Ab tumhara foreign chef (computer) Hindi nahi samajhta. Toh tum ek smart translator (Compiler) ko dete ho, aur wo poora recipe ek baar mein English mein convert karke de deta hai.

javac Hello.java

that command tells the java compiler that take .java file and convert it into .class file(bytecode).

Assembler

Actually in java there is no assembler

Assembler is mainly for low level language like C, C++.

Assembler = Ek aisa banda jo Assembly language ko machine ke 0s aur 1s mein convert karta hai. Jaise kisi ko shorthand likh ke diya ho, aur wo usse full text mein likh de

Java mein kya hota hai
Java mein:

  1. Java code likha jaata hai (.java)

  2. Compiler (javac) use Bytecode (.class) mein convert karta hai

  3. JVM (Interpreter + JIT) bytecode ko machine code mein chalata hai

Datatypes

You can say datatype is basically a container in which you can store different type of data.

Socho tumhare paas alagalag dabbe (boxes) hain:

Ek dabba sirf chips ke liye

Ek sirf rasgulla ke liye

Ek sirf pani ke liye

Datatype is of two type:

1.Primitive datatype

📦 Data Type🧾 What did it store
intNumbers (like 1, 2, 100)
floatDecimal numbers (like 3.14)
charSingle character (like 'A')
StringText (like "Hello")
booleantrue ya false
doubleBig decimal numbers
longBada number (when int not enough)

2.Non Primitive datatype

Non-Primitive = Java ke fancy dabbe
Jo khud ke andar aur bhi dabbe rakh sakte hain
Ya khud hi chhoti classes ban jaate hain.

primitive: It store same type of data.

non primitive: It store combination of different type of data.

🔹 Primitive🔸 Non-Primitive
Fixed size, simpleBig, complex, customizable
Stores actual valueStores reference (address)
Fast & easyPowerful but thoda heavy
Example: int, charExample: String, Array

JDK(Java Development Kit)

It is a tool box of java. In which you can write the java code and also compile it or run the java program.

Suppose you want to make a burger

So what did JDK do its gives you all the ingredients that require to make burger

means it gives you all the thing and then write the java code, make it, run it.

Inside JDK there are things

JRE: It is like a microwave(It run the java code)

Compiler(javac): It make a java code into machine language

Debugger: it search the mistakes

tools: extra items

JRE

JRE = The thing that helps your Java program run Like, you already made the code. now JRE is the stuff that says: "Cool, let me run this for you, bro!"

Imagine you made a pizza (your Java code)
Now you wanna Imagine you made a pizza (your Java code) Now you wanna heat it up and eat it, right?

JRE is like the microwave that helps you run (heat) the pizza.

JRE be like: “I won’t make your pizza... but I’ll totally heat it and serve it!”

Inside JRE

JVM

The brain that actually runs your Java code

Libraries

Pre-made tools Java needs to work

Runtime files

Little helpers that work in the background

  • If you’re writing Java code → You need JDK (has everything)

  • If you’re just running code → You only need JRE

JVM
JVM = The brain of Java. It’s like the cool dude who reads Java's bytecode and makes sure your program actually runs on your computer.

Imagine you wrote your Java code → It became bytecode (.class file). Now someone has to understand that bytecode and run it on your PC...

That someone is JVM

JVM be like:
“Chill bro, give me the bytecode... I’ll take care of it!”

Java code = Recipe

Compiler = Chef who writes the recipe in bytecode

JVM = The actual cook who reads the recipe and cooks it for your system

What JVM does

Reads bytecode

“Lemme see what you wrote, bro.”

Runs the program

“Okay! Let’s make it work!”

Memory Management

Keeps your RAM clean like a housekeeper

Garbage Collection

Throws out trash code/data

Identifier

Identifier means name given to the class, variable, interface, methods in java code.

The name you give to things in your java program

Imagine your code is a classroom

. there are students(variables)

. Teachers (methods)

. Subjects (classes)

class B_tech{

    int stu1=1;

    String name = "Riya";

    teachers(){

    }

}
0
Subscribe to my newsletter

Read articles from Khelendra Kumar Thakur directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Khelendra Kumar Thakur
Khelendra Kumar Thakur