JavaJava Introduction

Java Introduction

Java is a general-purpose, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. First released by Sun Microsystems in 1995, it has grown into one of the most widely used languages in the world, powering everything from Android apps and enterprise backend systems to embedded devices, big data tools, and financial trading platforms.

Write Once, Run Anywhere

Java’s defining idea is portability. Instead of compiling source code straight into machine instructions for a specific operating system, Java compiles to an intermediate form called bytecode. That bytecode runs inside the JVM (Java Virtual Machine), which is available for Windows, macOS, Linux, and many other platforms. The practical result is the famous slogan “Write Once, Run Anywhere” (WORA) — you compile your code a single time, and the same output runs unmodified anywhere a JVM is installed.

  • Object-oriented — code is organized around classes and objects, which encourages reusable, maintainable design.

  • Statically typed — variable types are checked at compile time, catching many bugs before the program ever runs.

  • Automatic memory management — a garbage collector reclaims memory, so you rarely manage it by hand.

  • Huge standard library — collections, networking, concurrency, I/O, and more ship with the platform.

  • Massive ecosystem — frameworks like Spring, build tools like Maven/Gradle, and a vast job market and community.

Where Java Is Used

Java shows up almost everywhere in professional software development:

  • Enterprise backends — banks, insurance companies, and large-scale web services run on Java (often with Spring Boot).

  • Android development — Android apps are traditionally written in Java (or Kotlin, which also runs on the JVM).

  • Big data — tools like Apache Hadoop, Kafka, and Spark are written in or built for the JVM.

  • Desktop and embedded software — from IDEs to point-of-sale systems.

A Quick Taste: Hello, World!

Every Java program starts life as a class. Here is the traditional first program, which simply prints a greeting to the console:

HelloWorld.java

Java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
Hello, World!

A few things are already visible here: the class name (HelloWorld) must match the file name, execution begins in a special main method, and System.out.println writes text to standard output. Later pages walk through each of these pieces in detail.

Compiled, Not Interpreted (Exactly)
Java is sometimes loosely called an “interpreted” language because the JVM executes bytecode, but it is more accurate to say Java uses a hybrid model: `javac` compiles source to bytecode ahead of time, and the JVM then interprets — and, for hot code paths, **JIT (Just-In-Time) compiles** — that bytecode into native machine instructions at runtime.
Tip
If you are coming from a language like Python or JavaScript, expect Java to feel more verbose up front (explicit types, more boilerplate for a simple program) in exchange for stronger compile-time safety and better tooling support at scale.