Java is a general-purpose, statically typed, object-oriented programming language that compiles source code into platform-independent bytecode, which runs on the Java Virtual Machine (JVM). Among programming languages, it is best known for the principle of write once, run anywhere, automatic memory management and a very large ecosystem for server-side and enterprise software.
Java was released by Sun Microsystems in 1995 and has been stewarded by Oracle since 2010, with the reference implementation developed in the open as OpenJDK. The language evolves through a six-month feature release cadence, while selected versions receive long-term support for production use.
How Java code runs on the JVM
Java code runs in two stages. The javac compiler first translates .java source files into bytecode stored in .class files, usually packaged in JAR archives. The JVM then loads these classes, verifies the bytecode for safety and executes it, which allows the same compiled program to run on Windows, Linux, macOS and other systems with a compatible JVM.
Execution starts in an interpreter, but the HotSpot JVM profiles running code and hands frequently executed methods to a just-in-time (JIT) compiler. Its tiered design uses a fast compiler for quick startup and an optimizing compiler for hot code, applying inlining, escape analysis and other optimizations based on real runtime behavior.
Memory is managed by a garbage collector, so developers allocate objects without freeing them manually. The table below lists the main collectors in current JDK versions.
| Collector | Design goal | Typical pause times | Typical use |
|---|---|---|---|
| G1 | Balanced throughput and latency | Tens of milliseconds | Default for most server applications |
| ZGC | Very low latency on large heaps | Usually under a millisecond | Latency-sensitive services |
| Shenandoah | Concurrent compaction, low pauses | Low milliseconds | Low-latency workloads |
| Parallel | Maximum throughput | Longer stop-the-world pauses | Batch processing |
| Serial | Small footprint | Varies with heap size | Small containers and tools |
Core language features
Java’s core features are static typing, class-based object orientation and a strict separation between primitives and objects. Every piece of code lives inside a class or interface, types are checked at compile time, and the language supports single class inheritance with multiple interface implementation.
Since Java 8, the language has added functional and data-oriented features at a steady pace: lambda expressions and streams, local type inference with var, records for immutable data carriers, sealed classes for restricted hierarchies, pattern matching in switch and instanceof, and virtual threads that make it practical to run hundreds of thousands of lightweight concurrent tasks.
| Version | Release year | Notable additions |
|---|---|---|
| Java 8 | 2014 | Lambdas, streams, new date and time API |
| Java 11 | 2018 | Standard HTTP client, var in lambdas |
| Java 17 | 2021 | Records, sealed classes, text blocks |
| Java 21 | 2023 | Virtual threads, pattern matching for switch |
| Java 25 | 2025 | Further language and runtime refinements |
Java compared with neighboring languages
Java is often compared with C#, its closest counterpart on .NET, with Kotlin and Scala, which also compile to JVM bytecode, and with dynamic languages such as Python. The comparison mostly concerns verbosity, runtime model and ecosystem rather than raw capability.
| Language | Runtime | Typing | Main difference from Java |
|---|---|---|---|
| Java | JVM | Static, nominal | Reference point |
| Kotlin | JVM, also native and JavaScript | Static with null safety | More concise syntax, built-in null safety |
| Scala | JVM | Static, advanced type system | Strong functional programming focus |
| C# | Common Language Runtime | Static, nominal | Similar model on the .NET platform |
| Python | Interpreter | Dynamic | Faster to write, slower to execute |
| C++ | Native code | Static | Manual memory control, no garbage collector |
Because Kotlin, Scala and Java share the JVM, they can call each other’s libraries directly, which lets teams adopt a newer JVM language gradually without rewriting existing Java code.
Where Java is used and how to choose a JDK
Java dominates enterprise back-end development, including banking, insurance, telecommunications and e-commerce systems, typically built with frameworks such as Spring or Jakarta EE. It also powers large data tools such as Apache Kafka, Hadoop and Elasticsearch. Android applications have long been written in Java, although Android runs them on its own runtime rather than a standard JVM and Kotlin is now preferred there.
Developers install a JDK (Java Development Kit), which contains the compiler, the JVM and tools. Several vendors build JDKs from OpenJDK sources, and they differ mainly in support terms and licensing, not in language features.
| Distribution type | Cost | Typical choice for |
|---|---|---|
| Community OpenJDK builds | Free | Most development and production use |
| Cloud vendor builds | Free | Workloads running on that vendor’s cloud |
| Commercial supported JDKs | Paid subscription | Organizations needing contractual support |
| Native image toolchains | Free and paid editions | Fast-starting containers and command-line tools |
Build tools such as Maven and Gradle manage dependencies from public repositories, and production teams usually standardize on one LTS version, upgrading every few years to stay within security support.
Limitations and common misconceptions
Java’s main weaknesses are verbosity, slower startup than native programs and a higher memory footprint caused by the JVM and its heap. Technologies such as class data sharing and ahead-of-time native images reduce startup time to milliseconds for serverless and container use, at the cost of longer builds and some restrictions on reflection.
- Java is not JavaScript: the two languages share only part of a name and some C-style syntax.
- Java is not inherently slow: JIT-compiled Java often approaches native performance for long-running services.
- Garbage collection does not prevent memory leaks: objects still referenced from caches or static fields are never freed.
- OpenJDK builds are free to use: licensing fees apply only to specific commercial distributions and support contracts.
In simple terms
Java is a language for writing software. Its special trick is a translator called the Java Virtual Machine. Programmers write their code once and turn it into a common in-between form. Any computer with the virtual machine can then run that same program.
This is a bit like writing a document in a widely understood language instead of a local dialect. It makes Java popular for large business systems that must run reliably for years. Banks, online shops and many apps quietly run on Java behind the scenes.
A practical example
A regional bank’s payments team maintains a Java 11 service that validates and routes card transactions. At peak times, the service handles several thousand requests per second, and thread pools limited to a few hundred platform threads cause queueing whenever a downstream fraud check slows down.
The team upgrades to Java 21, switches the request handling to virtual threads and changes the garbage collector from G1 to generational ZGC. No business logic is rewritten. Load tests show that the service now keeps many more requests in flight during slow fraud checks, and pause-related latency spikes drop to sub-millisecond levels, so the bank meets its response-time targets without adding servers.