Java Tutorial
Master enterprise-grade Java — 86 lessons from first program to advanced multithreading and architecture.
Learn Java from scratch to enterprise — types, OOP, collections, generics, streams, concurrency, JVM internals, modern Java 17-21, and a full Spring Boot &…
Part of the free Java course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
Start with Lesson 1 and learn one of the world's most in-demand programming languages step by step.
Lessons in this course
- Introduction to Java — What Java is, how it runs, and how to write and compile your first program
- Variables and Data Types — Declare int, String, boolean, double — the types you'll use every day
- Data Types (Primitives & Ranges) — All 8 primitive types, their ranges, and when to use each
- Type Casting — Widening, narrowing, and converting between types safely
- User Input with Scanner — Read keyboard input with the Scanner class
- The Math Class — Math.abs, pow, sqrt, round, random and more
- StringBuilder & Formatting — Build strings efficiently and format with printf / String.format
- ArrayList — The resizable list you'll use constantly — add, get, remove, loop
- HashMap — Store and look up key-value pairs fast
- Checkpoint: Java Basics — Combine input, collections and formatting in a build challenge — then a quiz
- Enums — Define a fixed set of named constants with behavior
- Switch Statement & Expressions — Classic switch plus modern switch expressions and arrow labels
- Wrapper Classes & Autoboxing — Integer, Double, Boolean — and how autoboxing works
- Access Modifiers — public, private, protected and package-private
- Packages & Imports — Organise classes into packages and import them
- Dates & Times (LocalDate) — The modern java.time API — LocalDate, LocalDateTime, formatting
- Comparable & Comparator — Sort objects your way with Comparable and Comparator
- Records — Concise immutable data classes (Java 16+)
- Regular Expressions — Match and extract text with Pattern and Matcher
- Checkpoint: Objects & Data — Combine records, comparators and switch in a build challenge — then a quiz
- Operators — Arithmetic, comparison, and logical operators with practical examples
- Control Flow — Write decisions in code with if, else if, else, and switch statements
- Loops — Repeat actions with for, while, and do-while loops
- Methods — Write reusable methods, pass parameters, and return values
- Arrays — Store and access lists of values with Java arrays
- Strings — Manipulate text with String methods, concatenation, and formatting
- Object-Oriented Programming — Create classes and objects to model real-world concepts
- Inheritance — Extend classes and reuse code through Java inheritance
- Interfaces and Abstract Classes — Define contracts with interfaces and share behaviour with abstract classes
- Exception Handling — Catch and handle runtime errors with try-catch-finally
- Collections Framework — Use ArrayList, HashMap, HashSet, and other collection types effectively
- Generics — Write type-safe, reusable code with Java Generics
- Advanced Java Methods & Overloading Mastery — Overloading, varargs, method references, and lambda-compatible signatures
- Deep Dive into Java OOP Design Patterns — Apply Singleton, Factory, Builder, and Decorator patterns in Java
- Interfaces, Abstraction & Best Practices — Default methods, sealed interfaces, and interface-first design
- Java Inner Classes & Anonymous Classes — Static, non-static, local, and anonymous inner classes explained
- Exception Handling Architecture in Large Systems — Custom exception hierarchies, chained exceptions, and error strategies
- Java Generics: Bounded Types, Wildcards & Type Erasure — Upper/lower bounds, ? wildcards, and how type erasure affects runtime
- Streams API Advanced Operations & Pipelines — Build complex data pipelines with filter, map, collect, and flatMap
- Lambda Expressions Deep Dive — Functional interfaces, method references, and lambda best practices
- Working with Optionals the Right Way — Eliminate null pointer exceptions with Optional chains and patterns
- Java Collections Framework Internals & Performance — How ArrayList, LinkedList, and HashSet work under the hood
- Advanced HashMap, TreeMap & LinkedHashMap Behaviors — Choose the right Map type and understand hashing, ordering, and complexity
- Multithreading in Java: Threads, Runnables & Executors — Create and manage threads, use thread pools and ExecutorService
- Concurrency Utilities: Locks, Semaphores & Latches — Coordinate threads safely with ReentrantLock, Semaphore, and CountDownLatch
- CompletableFuture & Asynchronous Programming — Chain async operations and handle results with CompletableFuture
- Memory Management & JVM Garbage Collection — How the JVM allocates memory and which GC algorithms to choose
- JVM Internals: Classloaders & Bytecode — How the JVM loads, verifies, and executes bytecode at runtime
- Reflection API & Dynamic Code Analysis — Inspect and invoke classes, fields, and methods at runtime
- Java Annotations: Custom, Built-In & Processing — Use and create annotations for frameworks, validation, and code generation
- I/O Streams & NIO2 for High-Performance File Handling — Read/write files efficiently with NIO2, Paths, and FileChannel
- Working with Databases using JDBC & Connection Pools — Query databases with JDBC, prepared statements, and connection pools
- Building REST APIs in Java (Servlets + HTTP basics) — Handle HTTP requests and build RESTful endpoints with Java Servlets
- JSON & XML Parsing with Jackson & JAXB — Serialise and deserialise JSON with Jackson and XML with JAXB
- Unit Testing in Java with JUnit & Mockito — Write tests with JUnit 5, mock dependencies with Mockito
- Maven & Gradle: Dependency Management at Scale — Manage dependencies, build lifecycle, and plugins with Maven and Gradle
- Modular Java (JPMS) Architecture Essentials — Structure large Java projects with the Java Platform Module System
- Deploying Java Applications (JAR/WAR) — Package and deploy Java apps as JARs, WARs, and Docker containers
- Logging & Monitoring with Log4j2 & SLF4J — Add structured logging with SLF4J and configure Log4j2 for production
- Secure Coding Practices for Java Developers — Prevent injection, insecure deserialization, and common Java vulnerabilities
- JavaFX for Desktop UI Development — Build desktop GUI applications with JavaFX scenes, controls, and CSS
- Networking in Java: Sockets, Clients & Servers — Build TCP/UDP clients and servers with Java socket programming
- Working with Threads Pools & Scheduled Executors — Execute tasks concurrently with ScheduledExecutorService and ForkJoinPool
- Performance Profiling with VisualVM & JProfiler — Find bottlenecks and memory leaks using Java profiling tools
- Microservices with Spring Boot (Intro) — Build and deploy a simple microservice with Spring Boot and REST
- Building CLI Tools with Java — Create command-line applications with argument parsing and output formatting
- Clean Architecture & Enterprise Patterns in Java — Structure enterprise Java apps with Clean Architecture and SOLID principles
- Final Project Ideas — Guided project ideas to put your Java skills into a real application
- Local Variable Type Inference (var) — Let the compiler infer local types with var — when it helps readability and when to avoid it
- Text Blocks — Multi-line string literals with """ — clean JSON, SQL and HTML without escaping
- Switch Expressions — Arrow labels, yield, and exhaustive switch that returns a value (Java 14+)
- Pattern Matching for instanceof — Test-and-cast in one step with binding patterns — no more redundant casts
- Sealed Classes — Restrict which classes may extend or implement a type with permits
- Record Patterns — Deconstruct records directly in switch and instanceof (Java 21)
- Method References — The four kinds of :: references and when each replaces a lambda
- Functional Interfaces — Function, Supplier, Consumer, Predicate and writing your own @FunctionalInterface
- Checkpoint: Modern Java — Combine records, sealed types, switch patterns and lambdas — then a timed quiz
- Collectors & Grouping — groupingBy, partitioningBy, toMap and joining to reshape stream results
- Virtual Threads — Lightweight threads for massive concurrency with Thread.ofVirtual (Java 21)
- The HttpClient API — Send synchronous and async HTTP requests with java.net.http.HttpClient
- equals() & hashCode() — Why they must agree, the contract, and Objects.equals / Objects.hash
- Immutability — Build truly immutable classes with final fields, defensive copies and records
- The Builder Pattern — Construct complex objects fluently and avoid telescoping constructors
- Dependency Injection — Decouple classes by injecting collaborators through constructors
- Serialization — Turn objects into bytes and back with Serializable, transient and serialVersionUID
- Checkpoint: Practical Java — Combine builders, immutability, collectors and HTTP into a small app — then a timed quiz
- Introduction to Spring & Spring Boot — Why Spring exists and how Spring Boot makes production Java fast to build
- Setting Up a Spring Boot Project — Spring Initializr, starters, @SpringBootApplication and the project layout
- IoC Container & Dependency Injection — The ApplicationContext, @Component, @Autowired and constructor injection
- Beans, Scopes & Configuration — @Bean, @Configuration, singleton vs prototype scopes, @Qualifier and @Primary
- Building REST Controllers — @RestController, @GetMapping/@PostMapping, ResponseEntity and JSON
- Request Mapping & Parameters — @PathVariable, @RequestParam, @RequestBody and HTTP status codes
- The Service Layer — @Service and separating business logic from controllers
- Repositories & @Repository — The repository pattern and the persistence boundary
- Spring Data JPA Basics — JpaRepository/CrudRepository and free CRUD with save/findById/findAll
- JPA Entities & Mapping — @Entity, @Id, @GeneratedValue, @Column and @Table
- Entity Relationships — @OneToMany, @ManyToOne, @ManyToMany, fetch types and cascades
- Derived Queries & @Query — findByX query methods, @Query JPQL, paging and sorting
- Bean Validation — @Valid, @NotNull/@Size/@Email and handling validation errors
- Exception Handling with @ControllerAdvice — @ControllerAdvice, @ExceptionHandler and clean error responses
- DTOs & Mapping — Why not to expose entities, DTOs, records and mapping
- Configuration & Properties — application.properties/yml, @Value and @ConfigurationProperties
- Profiles & Environments — @Profile and per-environment configuration
- Spring Security Basics — SecurityFilterChain, authentication vs authorization and BCrypt
- JWT Authentication — Stateless auth with JSON Web Tokens and a security filter
- Testing with @SpringBootTest & MockMvc — @SpringBootTest, @WebMvcTest, MockMvc and @MockBean
- Testing the Data Layer — @DataJpaTest, test slices and Testcontainers
- Monitoring with Actuator — /health, /metrics, /info endpoints and Micrometer
- Caching with @Cacheable — @EnableCaching, @Cacheable/@CacheEvict and cache providers
- Containerizing a Spring Boot App — Dockerfiles, layered jars and buildpacks
- Capstone: A Complete REST API — Build a full CRUD REST API end to end with everything you learned
- Database Migrations with Flyway — Versioned schema migrations that run on startup — safer than ddl-auto in production
- API Docs with OpenAPI & springdoc — Auto-generate Swagger UI and an OpenAPI spec with springdoc annotations
- Async & Scheduled Tasks — @Async background work and @Scheduled cron jobs with thread pools