The complete guide to the backend development language
β Java Complete Guide
Learn Java, the standard language of the enterprise. Covers what you need in practice: the JVM, object orientation, collections, exception handling, concurrency, the Stream API, and Spring Boot.
Beginner
Updated Oct 1, 2026
~4 min read
11 sections
8 code examples
Web IDE lab included
β
Java Web IDE
Run code in the browser with nothing to install and learn through step-by-step examples.
Learn Java, the standard language of the enterprise. Covers what you need in practice: the JVM, object orientation, collections, exception handling, concurrency, the Stream API, and Spring Boot. Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.
Key perspective
Backend / systems development
Before syntax, pin down the boundaries a request crosses: validation, processing, storage, and response.
Spring Boot serversAndroid developmentEnterprise systemsApache Kafka
Architecture diagrams
To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning Java.
Learning flow
Rendering diagramβ¦
Architecture view
Rendering diagramβ¦
Environment setup
When you first open Java, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.
With SDKMAN you can keep several Java versions installed on one machine and switch easily to the version each project needs. Unless you have a specific reason not to, use the latest LTS (long-term support) version by default.
Here you look at Basic syntax alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
The headline features of Java 21 β Records, Pattern Matching, and Sealed Classes β all move toward "expressing data more safely and concisely". A Record is an immutable data class that generates the getters, equals, hashCode, and toString for you, and Pattern Matching reduces instanceof plus a cast to a single statement.
Here you look at Object-oriented programming alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Java OOP design patterns using interfaces, abstract classes, and generics.
Here you look at Collections framework alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
When choosing a collection, first decide "does order matter", "are duplicates allowed", and "do I need to look up by key", and the right type follows naturally. ArrayList and HashMap are the defaults, but depending on the requirements there are better-suited implementations.
collections.javaJAVA
List<String> names = new ArrayList<>(List.of("Ada", "Linus", "Grace"));Set<String> unique = new HashSet<>(names); // removes duplicates, order not guaranteedMap<String, Integer> ageByName = new HashMap<>();ageByName.put("Ada", 30);// When insertion order must be keptMap<String, Integer> ordered = new LinkedHashMap<>();// When it must stay sortedSet<Integer> sorted = new TreeSet<>(List.of(5, 3, 8, 1)); // [1, 3, 5, 8]
HashMap (unordered), LinkedHashMap (insertion order), TreeMap (sorted by key)
Exception handling
Here you look at Exception handling alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Java exceptions divide into Checked Exceptions, whose handling is enforced at compile time, and Unchecked (Runtime) Exceptions, where it is not. The try-with-resources statement closes resources such as files and connections automatically without an explicit finally block.
exceptions.javaJAVA
// try-with-resources β close() is called automatically when the block endstry (BufferedReader reader = new BufferedReader(new FileReader("data.txt"))) { String line = reader.readLine();} catch (IOException e) { throw new RuntimeException("Failed to read the file", e); // always wrap and rethrow with the cause (e)}// Custom exception β express the failure with a meaningful nameclass InsufficientBalanceException extends RuntimeException { public InsufficientBalanceException(String message) { super(message); }}public void withdraw(int amount) { if (amount > balance) { throw new InsufficientBalanceException("Insufficient balance: requested " + amount + ", balance " + balance); } balance -= amount;}
Kind
Examples
Is handling enforced
Checked Exception
IOException, SQLException
The compiler enforces a catch or a throws declaration
Unchecked Exception
NullPointerException, IllegalArgumentException
Not enforced β it usually indicates a programming error
Stream & Lambda
Here you look at Stream & Lambda alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Implement functional-style data processing with the Java Stream API.
Here you look at Concurrency & multithreading alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Instead of creating Threads directly, the standard is to use an ExecutorService, which manages a thread pool for you. When the results of several asynchronous tasks have to be combined, CompletableFuture chains them like a pipeline without callback hell.
concurrency.javaJAVA
// ExecutorService β manages work with a thread poolExecutorService executor = Executors.newFixedThreadPool(4);Future<Integer> future = executor.submit(() -> heavyComputation());Integer result = future.get(); // wait until it completesexecutor.shutdown();// CompletableFuture β compose asynchronous work like a pipelineCompletableFuture<String> pipeline = CompletableFuture .supplyAsync(() -> fetchUserId()) .thenApply(id -> fetchUserName(id)) .thenApply(name -> "Hello, " + name) .exceptionally(ex -> "Error: " + ex.getMessage());pipeline.thenAccept(System.out::println);
Spring Boot
Here you look at Spring Boot alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Build a RESTful API server quickly with Spring Boot 3.x. Routing, DI, JPA, and Security in Spring Boot itself are covered in more depth in the separate Spring Boot guide.
UserController.javaJAVA
@RestController@RequestMapping("/api/users")@RequiredArgsConstructorpublic class UserController { private final UserService userService; @GetMapping public List<UserDto> getAll() { return userService.findAll(); } @PostMapping @ResponseStatus(HttpStatus.CREATED) public UserDto create(@Valid @RequestBody CreateUserRequest req) { return userService.create(req); }}
Java practical design
Java practical design is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
With Java, make interfaces and package boundaries clear. Dividing the domain model, application services, and infrastructure adapters lets you separate Spring dependencies from the core logic.
Decision point
Question to ask
Practical guideline
Boundaries
Which parts of the Java code are most likely to change?
Separate input/output, configuration, external integrations, and the core rules.
State
Where is state created and where does it go away?
Make the owner and lifecycle of state visible in the code.
Failure
What does the caller receive on failure?
Decide the timeout, fallback, and error contract first.
Java operating standards
This section covers Java operating standards from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
The essentials of JVM operations are the heap, GC, thread pools, connection pools, and classpath/config management.
Java verification strategy
Java verification strategy is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Use JUnit unit tests together with Testcontainers integration tests, contract tests, and concurrency tests.
Quality axis
How to verify
Definition of done
Correctness
Automate the normal/failure cases.
The core scenarios pass reproducibly.
Regression prevention
When fixing a bug, leave the same case behind as a test.
The same failure is not deployed again.
Operability
Check the logs, metrics, and alerts.
There is a path for tracing the cause when a problem occurs.
Java: frequently asked questions
What is the difference between the JDK, JRE, and JVM?
The JVM is the virtual machine that runs compiled bytecode, the JRE is the runtime that adds the standard library to the JVM, and the JDK adds the compiler and development tools on top. Development needs a JDK, and these days deployments also commonly use JDK-based images or a runtime bundled with only the modules needed.
Which Java version should I use?
For a new project, use the latest long-term support (LTS) version. LTS versions receive security patches for years, and frameworks and libraries target them. Also check the minimum version required by the framework you use.
What should I check when an OutOfMemoryError occurs?
Start by reading the message to see whether it is heap space or metaspace. For the heap, take a heap dump and analyze which objects piled up to decide whether it is a leak or simply a heap that is too small. In a container, also check that the memory limit and the JVM heap settings agree.