Java Tutorial
Master enterprise-grade Java — 114 lessons from first program to advanced multithreading and architecture.
Learn Java from scratch to enterprise: types, OOP, collections, generics, streams and concurrency, then JVM internals, modern Java and Spring Boot.
👋 New to Java? No experience needed.
Start with Lesson 1 and learn one of the world's most in-demand programming languages step by step.
Continue where you left off
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
- 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
- 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
- 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
- Regular Expressions — Match and extract text with Pattern and Matcher
- Object-Oriented Programming — Create classes and objects to model real-world concepts
- Inheritance — Extend classes and reuse code through Java inheritance
- 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
- 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
- equals() & hashCode() — Why they must agree, the contract, and Objects.equals / Objects.hash
- Records — Concise immutable data classes (Java 16+)
- Comparable & Comparator — Sort objects your way with Comparable and Comparator
- Checkpoint: Objects & Data — Combine records, comparators and switch in a build challenge — then a quiz
- 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
- 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
Frequently asked questions
Is Java a good language for beginners?
Java is beginner-friendly in that it is strict and consistent — its static typing catches mistakes early and teaches good habits. It is more verbose than Python, but that structure helps you understand exactly what your program is doing.
How long does it take to learn Java?
Fundamentals (syntax, OOP, collections) take 2–3 months. Reaching job-ready level for backend or Android development, including frameworks like Spring, usually takes 6–12 months of consistent project work.
What is Java used for?
Java powers large-scale enterprise backends, Android apps, financial systems, and big-data tools (Hadoop, Kafka). It is prized for stability, performance and a massive ecosystem, which keeps it in constant demand.
Is Java still relevant in 2026?
Very much so. Java consistently ranks among the top languages by job demand, especially in enterprise, banking and Android development, and modern versions keep adding features that keep it competitive.
More for this course
- Java cheat sheet — Quick syntax reference you can scan while you code
- Java Collections Framework: A Deep Dive — Master Lists, Sets, Maps, Queues and their real-world use cases. Learn ArrayList, HashMap, TreeSet, PriorityQueue, performance comparisons, and best practices.
- Java Generics Made Simple — Learn how to write type-safe, reusable code with Java generics.
- C++ vs Java: Which Should You Learn First? — A detailed comparison of C++ and Java to help you decide which language is the best fit for your goals and career path.