Java
Java powers enterprise apps, Android builds, and backend systems through its "write once, run anywhere" runtime and strong tooling.
Reserved Words
- abstract, assert, boolean, break, byte
- case, catch, char, class, const, continue
- default, do, double
- else, enum, extends
- final, finally, float, for
- goto, if, implements, import, instanceof, int, interface
- long, native, new
- package, private, protected, public
- return, short, static, strictfp, super, switch, synchronized
- this, throw, throws, transient, try
- void, volatile, while
- true, false, null (literals)
Platform Pillars
- JVM bytecode executes on HotSpot, OpenJ9, GraalVM, and Azul runtimes.
- Garbage collection options include G1, ZGC, Shenandoah, Serial, Parallel.
- Modular JDK (JPMS) decomposes the platform for smaller deployments.
- JIT and AOT modes deliver adaptive performance.
Language Features
- Generics with type erasure and bounded wildcards (`List extends Number>`).
- Records, sealed classes, and pattern matching (JEP 440+) streamline modeling.
- Lambda expressions fuel Streams API for declarative data pipelines.
- Virtual threads (Project Loom) scale structured concurrency.
- Switch expressions and text blocks reduce boilerplate.
Core APIs
- java.lang: Object, String, Math, records, enums.
- java.util: collections, Optional, concurrent data structures.
- java.time: immutable ISO-8601 clocks.
- java.net.http: HTTP/2 client with WebSocket support.
- java.nio: buffers, channels, file walking.
- Spring, Micronaut, Quarkus, Jakarta EE extend cloud features.
Operators
- Arithmetic: + - * / % ++ --
- Comparison: == != > < >= <=
- Logical: && || !
- Bitwise: & | ^ ~ << >> >>>
- Assignment: = += -= *= /= %= &= |= ^= <<= >>= >>>=
- Instance checks: instanceof, pattern matching `instanceof Point(var x, var y)`.
Build & Tooling
- Gradle, Maven, and Bazel orchestrate builds, dependency graphs, and publishing.
- JLink creates trimmed runtime images; JPackage ships native installers.
- Testing ecosystems: JUnit 5, TestNG, AssertJ, Mockito, WireMock.
- Observability: Flight Recorder, Mission Control, async-profiler.
Best Practices
- Favor immutable data and builder patterns to reduce defensive copies.
- Use `var` for local inference where it clarifies types.
- Run SpotBugs, Error Prone, and Checkstyle in CI for safety.
- Package microservices with layered Docker images and JDK 21 LTS.