Java course menu
Introduction to Java: What It Is, Where It Is Used, and How It Runs
A beginner-friendly introduction to Java: what the language is, where it is used (Android, backend services, enterprise systems, big data), how the JDK, JVM and bytecode work, how Java compares with C++ and Python, and what you will learn in this course.
On this page
Java is a general-purpose, object-oriented programming language designed to be reliable, readable and portable. Its famous promise is "write once, run anywhere": the same compiled program runs on Windows, macOS and Linux without changes. For three decades it has been one of the most widely used languages in the world, especially for large business systems and server software.
A first look#
Here is a complete Java program:
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, Java!");
}
}Hello, Java!Every Java program is made of classes, and execution starts in a method called main. You will write and run this program yourself in First Java Program.
Where Java is used#
Java skills are in demand for backend developer, Android developer and software engineer roles.
How Java runs: bytecode and the JVM#
Java sits between compiled languages like C++ and interpreted languages like Python:
- You write source code in a file such as
Hello.java. - The compiler (
javac) translates it into bytecode (Hello.class), a compact instruction set that is not tied to any particular processor. - The Java Virtual Machine (JVM) runs the bytecode. While running, its just-in-time (JIT) compiler turns frequently used code into fast native machine code.
Because every operating system has its own JVM, the same .class files run everywhere.
You will meet three abbreviations:
Memory is managed for you#
In Java you create objects with new, but you never free them yourself. The JVM's garbage collector automatically reclaims objects that are no longer used. This removes whole categories of bugs common in C and C++, such as memory leaks from forgotten frees and crashes from using freed memory.
Java compared with other languages#
Java's syntax looks like C++ (curly braces, semicolons, if, for), so learning one makes the other much easier.
Java versions#
Java gets a new release every six months, and every two years one becomes a long-term support (LTS) version that companies use for years: Java 8, 11, 17, 21 and 25. This course targets Java 21, and everything shown also works on newer versions. Modern Java has features that make code much shorter than older tutorials suggest, such as var, records, switch expressions and text blocks.
Is Java hard to learn?#
Java asks you to declare types and write a little more code than Python, and every program needs a class. In return, the compiler catches many mistakes before your program runs, and the language is very consistent. Its clear structure is why many universities teach Java as a first language.
What you will learn#
- Fundamentals: variables, types, operators and input.
- Control flow:
if,switchand loops. - Methods: parameters, return values, overloading and recursion.
- Arrays and strings, including
StringBuilderand wrapper classes. - Object-oriented programming: classes, inheritance, interfaces, records and enums.
- The Collections Framework:
ArrayList,HashMap,HashSet, queues and sorting. - Advanced Java: exceptions, files, generics, lambdas, streams, threads and modern features.
Key takeaway#
Next, set up Java in Installing Java (JDK).
Finished this lesson?