How to use this topic

The first eight pages cover the basics: what Java and the JVM are, the JDK and your first program, types and operators, strings, control flow, loops, methods, and arrays and collections. The next seven are about designing with types: classes, records, enums and sealed types, inheritance and interfaces, null and Optional, exceptions, generics, and lambdas and streams. The last five show Java in real work: files and JSON, concurrency, packages and build tools, testing, and running Java in production.

Every example is a complete program that runs with java Main.java on Java 25 and shows its exact output. General programming ideas are explained in Programming Concepts; where Java differs from Python, JavaScript or C#, the pages say so.

The language pages are tagged OCP Java SE 25: they cover material of Oracle Certified Professional: Java SE 25 Developer, a professional-level exam rather than a beginner certificate.

Learning path

  1. 01What Is Java?What Java is and where it runs: the Java Virtual Machine, bytecode, the JDK and JRE, OpenJDK builds and licenses, and the six-monthly release cycle with long-term support versions.Beginner
  2. 02The JDK, javac, java and Your First ProgramInstalling a JDK, compiling with javac and running with java, launching a single source file directly, compact source files with void main(), reading input and trying code in JShell.BeginnerOCP Java SE 25
  3. 03Variables, Types and OperatorsJava's static types: primitive types versus objects, var, literals and conversions, integer division and overflow, floating-point surprises and BigDecimal for money.BeginnerOCP Java SE 25
  4. 04Strings and TextWorking with text in Java: immutable strings, comparing with equals instead of ==, common String methods, StringBuilder, text blocks and formatting numbers and dates.BeginnerOCP Java SE 25
  5. 05Control Flow and Switch ExpressionsMaking decisions in Java: if and else, the conditional operator, the classic switch statement and modern switch expressions with arrows and pattern matching.BeginnerOCP Java SE 25
  6. 06Loops and IterationRepeating work in Java: for, enhanced for, while and do-while loops, break and continue with labels, and iterating safely over collections.BeginnerOCP Java SE 25
  7. 07Methods and ParametersWriting methods in Java: parameters and return values, why Java always passes by value, overloading, varargs, static methods and recursion.BeginnerOCP Java SE 25
  8. 08Arrays and CollectionsStoring groups of values: arrays, the List, Set and Map interfaces with ArrayList, HashSet and HashMap, immutable List.of and Map.of, sorting and sequenced collections.BeginnerOCP Java SE 25
  9. 09Classes and ObjectsDefining your own types in Java: fields, constructors, methods, this, encapsulation with access modifiers, getters, static members, and equals, hashCode and toString.BeginnerOCP Java SE 25
  10. 10Records, Enums and Sealed TypesJava's compact data types: records for immutable data, enums for fixed sets of values, sealed classes and interfaces, and record patterns in switch.IntermediateOCP Java SE 25
  11. 11Inheritance, Interfaces and PolymorphismBuilding type hierarchies in Java: extends and super, overriding with @Override, abstract classes, interfaces with default methods, and polymorphism through dynamic dispatch.IntermediateOCP Java SE 25
  12. 12Null, Optional and NullPointerExceptionWhy null causes so many Java bugs, how to read a helpful NullPointerException message, defensive checks with Objects, and when Optional makes absence explicit.IntermediateOCP Java SE 25
  13. 13Exceptions and Error HandlingHandling errors in Java: try, catch and finally, checked versus unchecked exceptions, throws, try-with-resources, custom exceptions and reading a stack trace.IntermediateOCP Java SE 25
  14. 14GenericsType-safe containers and methods in Java: type parameters, generic classes and methods, bounded types, wildcards, and what type erasure means in practice.IntermediateOCP Java SE 25
  15. 15Lambdas, Functional Interfaces and StreamsFunctional style in Java: lambda expressions, method references, functional interfaces such as Function and Predicate, and the Stream API for filtering, mapping, grouping and collecting.IntermediateOCP Java SE 25
  16. 16Files, I/O and JSONReading and writing files with java.nio.file, paths, charsets and try-with-resources, dates and times with java.time, calling web APIs with HttpClient, and handling JSON with a library.IntermediateOCP Java SE 25
  17. 17Concurrency: Threads, Executors and Virtual ThreadsDoing several things at once in Java: threads, executors and futures, virtual threads, shared state and synchronization, and the concurrent collections.AdvancedOCP Java SE 25
  18. 18Packages, Modules and Build ToolsOrganizing and building Java projects: packages and imports, the classpath and JAR files, the module system, and building with Maven and Gradle and their dependency management.IntermediateOCP Java SE 25
  19. 19Testing and Code QualityKeeping Java code correct: unit tests with JUnit, assertions and parameterized tests, test doubles, formatting and static analysis, and compiler warnings.Intermediate
  20. 20Running Java in ProductionWhat operations people need to know about Java applications: the heap and garbage collection, JVM options such as -Xmx, logs, thread dumps with jcmd and jstack, and common failures such as OutOfMemoryError.Intermediate

Java glossary

Short definitions of the terms used in this topic. The full glossary covers every topic.