01 - Java Programming Fundamentals
A hands-on start with Java: how javac and the JVM work, which JDK to install, your first program run for real, bytecode and naming conventions.
Eighteen articles to learn Java with code compiled and run on JDK 21: syntax, OOP, collections, exceptions, I/O, streams, concurrency, the JVM, testing with JUnit and Mockito, SOLID, patterns, Maven and Gradle, up to the dependency injection that prepares you for Spring.
This series collects 18 articles (approximately 267 minutes of total reading time), designed for a level Beginner. The main topics covered are Java, JDK 21, OOP, collections.
A hands-on start with Java: how javac and the JVM work, which JDK to install, your first program run for real, bytecode and naming conventions.
Pick the right Java type for each value, see what goes wrong when you choose badly, and control the flow with if, switch and loops, with code run on JDK 21.
Write Java methods with the right signature, avoid overload ambiguity, know what pass by value does to your data, and work with arrays, matrices and Arrays.
Build Java classes whose objects defend their own data: constructors, encapsulation, this, static members and records, with listings run on JDK 21.
Abstract classes, interfaces, polymorphism and sealed types in Java 21: the real compiler errors when a contract is broken, and how to choose.
String, StringBuilder, wrapper classes and java.time in Java, each starting from a concrete trap, with listings run on JDK 21 and fixed dates.
Lists, sets, maps and queues in Java 21: how to choose, the most common mistakes, and the timings measured on ArrayList, LinkedList and ArrayDeque.
Checked and unchecked exceptions in Java 21, reading a stack trace, domain exceptions and try-with-resources, with the real compiler messages.
Read and write files in Java with java.io and NIO.2: buffers, charsets, Path and Files, directories, serialization and its limits, with listings run on JDK 21.
Lambdas, method references, streams, collectors and Optional in Java, with the traps that cost hours and the cases where a plain for loop is still better.
Threads, race conditions, locks, executors, CompletableFuture and BlockingQueue in Java, in the order that keeps your data safe, with listings run on JDK 21.
Stack, heap, garbage collector and JIT in OpenJDK 21: the -Xss, -Xms and -Xmx flags, GC logs and JFR, with real measurements and a memory leak reproduced.
Testing in Java with JUnit 5 and Mockito: assertions, parameterised tests, mock, stub and fake, and a TDD step from red to green, with real output.
SOLID, naming, code smells and exception handling in Java, with run examples, showing how to make code easy to change and when not to apply the rules.
Singleton, Factory, Builder, Strategy and Observer in Java 21: what each pattern gains and costs, with tested listings and Spring Boot backend examples.
Maven versus Gradle: lifecycle, dependency conflicts resolved in opposite ways, and a reading of the pom.xml of a real Spring Boot backend, with real runs.
Configuration outside the code, secrets in the environment and readable logs with SLF4J and the MDC in Java, with run listings and a real Spring Boot backend.
Inversion of Control and Dependency Injection in plain Java: a minimal container, repository as a domain port, and the check-then-write race.
Have you read all the articles? Check how much you've learned by taking this series' quizzes.