What is Java?
Java is a popular language that you compile once and run almost anywhere, thanks to the JVM.
What you will learn
- Say what Java is in plain words
- Understand compile then run, and the JVM
- Spot where Java is used in the real world
A friendly definition
Java is a programming language — a way to write instructions a computer can follow. You write Java in plain text files, and the computer turns them into a running program. Java has been one of the most-used languages in the world for over 25 years.
Java is famous for one big idea: write once, run anywhere. The same Java program can run on Windows, Mac, Linux and even Android phones, without rewriting it.
Compile, then run
Some languages run your text directly. Java does two steps instead:
- Compile: a tool called
javacreads your.javafile and turns it into bytecode (a.classfile). - Run: the JVM (Java Virtual Machine) reads that bytecode and actually runs your program.
The JVM is the clever part. Every operating system has its own JVM, but they all understand the same bytecode. That is why one compiled Java program runs everywhere.
| Step | Tool | Turns this into that |
|---|---|---|
| Write | A text editor | Hello.java (your code) |
| Compile | javac | Hello.class (bytecode) |
| Run | The JVM (java) | A running program |
Tip: Think of bytecode like a universal recipe, and the JVM like a chef in every country. The recipe never changes — each local chef knows how to cook it on their own stove.
Where Java is used
- Big business and banking systems that must be reliable.
- Android apps (Android was built around Java).
- Large web back-ends (often with the Spring framework).
- Tools, games and even parts of other software.
Q. What does the JVM (Java Virtual Machine) do?
✍️ Practice
- In one sentence, explain the difference between compiling and running.
- List three kinds of software that are built with Java.
🏠 Homework
- Write 3 to 4 sentences explaining to a friend what Java is and why write once, run anywhere is useful.