Programming languages
Java
A statically typed JVM language: the base of enterprise backends, Android and large systems.
What it is
Sun Microsystems created Java, with a first release in 1995. Code compiles to bytecode and runs on the JVM, so it works on any platform with a Java Virtual Machine.
The language evolves through OpenJDK and the JEP process. New versions ship every six months, and LTS releases (17, 21, 25) are supported for a long time. Modern Java has records, sealed classes, pattern matching and virtual threads.
The ecosystem is huge: Spring Boot, Maven and Gradle, Hibernate. Kafka and Elasticsearch are written in Java. The JVM also runs Kotlin, Scala and Clojure.
Use it when
- Enterprise backends and financial systems where maturity and stability matter.
- Large teams and long projects: strict typing and tooling help maintenance.
- High-throughput, long-running systems (the JIT warms up well).
Avoid it when
- Small scripts and CLIs where fast startup and low memory matter.
- Quick prototypes: the code is wordier than Python or Kotlin.
Key concepts
- JVM
- The virtual machine that runs bytecode, manages memory and optimizes hot code through the JIT.
- Garbage collector
- Automatic memory reclamation. Several collectors (G1, ZGC) trade off pause times and throughput.
- Record
- A compact immutable data type: constructor, accessors, equals and hashCode are generated.
- Virtual threads
- Lightweight threads (Java 21) for many blocking operations without complex async code.
- Maven / Gradle
- Build and dependency management tools.
Example
Cheat sheet
| Command or code | What it does |
|---|---|
javac Main.java && java Main | Compile and run |
java Main.java | Runs a single file without a separate compile step |
List<String> xs = List.of("a", "b"); | Immutable list |
Map<String, Integer> m = new HashMap<>(); | Key value map |
list.stream().filter(x -> x > 0).toList() | Filtering with a Stream |
record Point(int x, int y) {} | Immutable data type |
var user = new User(); | Local variable type inference |
try (var in = Files.newInputStream(p)) { } | Automatic resource closing |
Optional.ofNullable(x).orElse(d) | Default value instead of null |
mvn test | Runs Maven tests |
How to learn it
- Install JDK 21 or newer and run your first program from an IDE.
- Learn the syntax, classes, objects and packages.
- Study collections (List, Map, Set), generics and exception handling.
- Understand the Stream API, lambdas and Optional.
- Go deeper into OOP: interfaces, inheritance, records and sealed classes.
- Meet Maven or Gradle and build a console application.
- Write tests with JUnit 5.
- Move on to Spring Boot and build a REST API with a database.
Interview questions
1. How do JDK, JRE and JVM differ?
The JVM runs bytecode. The JRE is the JVM plus the standard library to run programs. The JDK adds the compiler and developer tools. Today a standalone JRE is rarely shipped.
2. How does garbage collection work?
It finds objects with no references and frees their memory. Memory is split into generations (young, old) because most objects die young. G1 is the default collector, ZGC gives very short pauses.
3. What is the difference between equals and ==?
==compares references (same object), whileequalscompares content if the class overrides it. When you overrideequalsyou must overridehashCodetoo.4. What are virtual threads?
Lightweight threads managed by the JVM, not the OS. You can create millions, so a thread-per-request style scales without reactive programming.
Related technologies
- Spring BootAn opinionated layer over Spring for Java and Kotlin with auto-configuration and one-command startup.
- KotlinA modern concise language for the JVM, Android and multiplatform development, fully interoperable with Java.
- Apache KafkaKafka is a distributed event log for high-throughput data streaming with durable storage.
- ElasticsearchElasticsearch is a distributed search and analytics engine built on Lucene with a REST API and JSON documents.
Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).