Introduction to Java – What is Java?
In this lesson: Java for beginners — what it is, why it is popular, key features and how the JVM makes it platform-independent, with a first program.
What is Java
Java is one of the world's most popular programming languages. It is general-purpose, meaning you can build almost anything with it — Android apps, websites, banking software and huge business systems. Java is known for being reliable, secure, and able to run on any device through the Java Virtual Machine (JVM).
Why Java is popular
- Everywhere. Android apps, banks, and big companies run on Java.
- Platform-independent. The same code runs on Windows, Mac and Linux.
- Strong OOP. Java teaches object-oriented programming clearly.
- Great for jobs. It is heavily used in placements and interviews.
Key features
| Feature | Meaning |
|---|---|
| Platform-independent | Runs anywhere with a JVM |
| Object-oriented | Built around classes and objects |
| Secure | Runs in a controlled JVM environment |
| Robust | Strong error and memory handling |
| Automatic memory | Garbage collector frees unused memory |
Write once, run anywhere
This is Java's biggest strength. Your code is compiled into bytecode — a middle form that is not tied to any one operating system. The JVM on each device runs that bytecode. So you write and compile once, and the same program runs on Windows, Mac, Linux and Android alike.
How Java runs
- You write Java code in a
.javafile. - The Java compiler (
javac) turns it into bytecode (a.classfile). - The JVM reads the bytecode and runs it on your device.
- Because every platform has its own JVM, the same bytecode runs everywhere.
So Java is both compiled (to bytecode) and interpreted (by the JVM) — that combination gives it portability.
A first look
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, Java!");
}
}
Hello, Java!
Every Java program lives in a class, and running starts from the main method. System.out.println prints a line of text. We will break this down fully in the next lessons.
Common mistakes
- Confusing Java with JavaScript. They are completely different languages.
- Thinking Java is old and unused. It runs Android and most large enterprise systems today.
- Forgetting the JVM. Java needs the JVM (part of the JDK/JRE) installed to run.
- Expecting to run
.javadirectly. It must be compiled to bytecode first.
Summary
- Java is a popular, general-purpose, object-oriented language.
- It is platform-independent: "write once, run anywhere" via the JVM.
- Code compiles to bytecode, which the JVM runs on any device.
- It powers Android, banking and enterprise software, and is big in jobs.
- Every program starts from the
mainmethod inside a class.
Next, install Java with the Java setup guide, or understand the engine in JDK, JRE and JVM.
