Java Full Portion
Basic - Advanced
Subbiah Pillai P
1. What is Java?
Java is a programming language used to build:
• Mobile apps (like Android apps),
• Websites (like Amazon, IRCTC),
• Desktop software (like Calculator),
• Games,
• ATM software, etc.
Features of Java:
• Simple – Easy to learn and use
• Object-Oriented – Based on real-world objects (we will learn soon)
• Platform-Independent – You write code once, it can run on Windows, Linux, Mac, etc.
• Secure – It has many built-in security features
• Robust – Java can handle errors well and avoids crashing
Real World Example:
Imagine you're writing a book. If you write it in English, any English reader can read it. Same way,
Java code (bytecode) can be read by any computer using JVM.
2. What is JVM (Java Virtual Machine)?
JVM is the engine that runs Java programs.
• It takes the .class file (bytecode)
• Converts it into machine code
• Runs the program on your system (Windows, Mac, Linux)
Why JVM is Special:
• JVM is different for Windows, Linux, etc.
• But it understands the same bytecode
• That’s why Java is platform-independent
Example:
Like a translator who reads one language (bytecode) and speaks in your local language (machine
code).
3. What is Bytecode?
Bytecode is a special code created by Java compiler.
How is it created?
1. You write a Java file → MyProgram.java
2. You compile it → creates MyProgram.class (this is bytecode)
• .java → is your code
• .class → is the bytecode
JVM reads .class file and runs it
Think like this:
• You write a recipe in English (.java)
• You translate it into a cooking script (.class)
• The kitchen (JVM) reads that cooking script and makes food (runs your code)
4. What is JIT (Just-In-Time Compiler)?
JIT is a small part inside JVM. It helps your program run faster.
• While JVM is running the program,
• JIT converts bytecode into machine code quickly
• It stores it in memory so the code doesn't need to be translated again
Think like this:
If you repeat a task many times, JIT helps JVM to remember it and reuse, which saves time.
5.What is JRE (Java Runtime Environment)?
JRE is needed to run Java programs.
JRE Contains:
• JVM (Java Virtual Machine)
• Library Files (pre-written Java code)
Example:
If your friend made a Java game, and you just want to play it, you only need JRE. You don’t need JDK
if you're not writing code.