Getting Started · Lesson 1 of 42
What Is Java? JDK, JRE and JVM
Java is one of the most widely used programming languages in the world. It runs the back-ends of banks, airlines, e-commerce sites and government systems, most Android apps started life in Java, and Indian IT service companies hire more Java developers than any other kind. If you are aiming at campus placements or Spring Boot jobs, Java is the language to know well.
In this lesson
- What makes Java different from C and Python
- How Java code becomes bytecode and runs on the JVM
- JDK vs JRE vs JVM – the classic interview question
- Where Java is used and which version to learn
Java in one sentence
Java is a compiled, object-oriented, platform-independent language. You write code once, compile it into bytecode, and that bytecode runs unchanged on Windows, macOS, Linux or a server in the cloud. The slogan from 1995 still holds: "Write once, run anywhere."
Java was created by James Gosling and his team at Sun Microsystems and is now developed by Oracle and the open-source OpenJDK community. A new version arrives every six months, and every two years one becomes a Long-Term Support (LTS) release that companies standardise on.
How a Java program runs
From source code to running program
- Hello.javaYou write source code in a text file
- javac compilesThe compiler checks it and produces Hello.class
- BytecodePortable instructions – the same file for every OS
- JVM runs itThe Java Virtual Machine interprets and JIT-compiles the bytecode
The trick is the Java Virtual Machine (JVM): a program that exists for every operating system and knows how to run bytecode. Your .class file never talks to Windows or Linux directly – it talks to the JVM, and the JVM talks to the machine.
Modern JVMs are fast because of the JIT (Just-In-Time) compiler: code that runs often is compiled to native machine code while the program runs. That is why long-running Java servers can be nearly as fast as C++.
JDK vs JRE vs JVM
These three are asked in almost every fresher interview. Think of them as boxes inside boxes:
Each one contains the next
- JDK – Java Development KitEverything to write Java: compiler (javac), debugger, tools + the JRE
- JRE – Java Runtime EnvironmentEverything to run Java: the JVM + the standard class library
- JVM – Java Virtual MachineThe engine that executes bytecode, manages memory and garbage collection
| JDK | JRE | JVM | |
|---|---|---|---|
| Purpose | Develop programs | Run programs | Execute bytecode |
| Contains | JRE + javac, jar, javadoc, jshell… | JVM + libraries (java.lang, java.util…) | Class loader, bytecode interpreter, JIT, garbage collector |
| Who needs it | Developers (you) | Users (older setups) | Everyone, inside the JRE |
Interview angle
"Is Java platform independent?" The bytecode is; the JVM is not. There is a different JVM for each operating system, and that is exactly what makes the same bytecode run everywhere. Since Java 11 there is no separate JRE download – you simply install a JDK.
Key features of Java
- Object-oriented – programs are built from classes and objects (chapters 8–10).
- Strongly and statically typed – every variable has a type checked at compile time, so many bugs are caught before the program runs.
- Automatic memory management – the garbage collector frees objects you no longer use. No
free()as in C. - Robust and secure – no pointer arithmetic, array bounds are checked, and exceptions make errors explicit.
- Multithreaded – built-in support for running tasks in parallel (chapter 15).
- Huge ecosystem – Spring Boot, Hibernate, Maven, Gradle, Kafka, Android and thousands of libraries.
Java vs C++ vs Python
| Java | C++ | Python | |
|---|---|---|---|
| Runs as | Bytecode on the JVM | Native machine code | Interpreted bytecode |
| Typing | Static | Static | Dynamic |
| Memory | Garbage collected | Manual (new/delete) | Garbage collected |
| Pointers | No (references only) | Yes | No |
| Multiple inheritance of classes | No (interfaces instead) | Yes | Yes |
| Typical use | Enterprise back-ends, Android | Games, systems, embedded | AI, data, scripting |
Where Java is used
Java careers
Java
- Back-end servicesSpring Boot REST APIs and microservices
- Banking & fintechPayments, trading and core banking systems
- AndroidAndroid SDK (alongside Kotlin)
- Big dataHadoop, Kafka, Spark (JVM based)
- IT servicesTCS, Infosys, Wipro, Accenture projects
- TestingSelenium and JUnit automation
Which version should you learn?
Learn on Java 21 or newer LTS. It is what new projects and Spring Boot 3 use, and it includes modern features you will meet in this course: var, switch expressions, text blocks, records, pattern matching and virtual threads. Everything in this course runs on Java 21 and later.
Practice
Quick check
What does javac produce?
A .class file containing bytecode.
Which one do you install to write Java programs: JDK, JRE or JVM?
The JDK. It contains the compiler and the JRE (which contains the JVM).
Why can the same .class file run on Windows and Linux?
Because each operating system has its own JVM that understands the same bytecode.
What does the JIT compiler do?
It compiles frequently executed bytecode into native machine code while the program runs, making it much faster.
Summary
- Java compiles source code to portable bytecode that runs on the JVM.
- JDK ⊃ JRE ⊃ JVM: develop, run, execute.
- It is object-oriented, statically typed and garbage collected, and dominates enterprise and IT-services jobs.
Finished this lesson?
Mark it complete to track your progress, then carry on with the next lesson.