Java Tutorials: Core Concepts with Runnable Examples

Focused tutorials on the parts of Java that actually trip people up β€” how parameters are passed, what ++i versus i++ really does, where a variable lives and dies, and how to stop writing println for formatted output. Every tutorial is short, runnable, and pinned to modern Java (17 and 21).

πŸ“š 6 tutorials ⚑ Runnable code πŸ†• Java 17 & 21 πŸ›  No setup needed

Methods & parameters

How arguments are passed, variadic methods, accessors, and formatted output.

Variables & operators

Where variables live, how long they stay alive, and the subtle operators that bite beginners.

What counts as a "tutorial" here?

A tutorial on this site is a short, self-contained deep-dive into a single Java concept with runnable code and a clear before/after for any common mistake. They are not a sequential course β€” if you are looking for a guided learning path from zero, start at Learn Java instead, which walks through primitives, OOP, collections and exceptions in order.

How to get the most out of each tutorial

  1. Read the code first, the prose second. Every tutorial opens with a working example. If you can already tell what it does, skim the explanation; if you can't, the explanation is written to fill exactly that gap.
  2. Run the example live. Paste into the Java Online Compiler and change one thing at a time β€” that is how the subtle behaviour (operator precedence, reference vs value, scoping) actually becomes intuitive.
  3. Check the "gotchas" section. Most tutorials end with the mistake the author sees in real code reviews. That is usually the reason you arrived at the page.

What to read next

Why the modern-Java angle

A lot of Java tutorials on the open web date from the Java 5–8 era and never got refreshed. They still teach raw HashMap iteration with Iterator, string concatenation in a loop, anonymous inner classes where a lambda now does the job, and SimpleDateFormat that nobody should touch in 2026. Every tutorial here is written β€” or rewritten β€” against Java 17 and 21, with the legacy alternative shown only when it is still common in real codebases so you can recognise it.

Missing something?

We prioritise tutorials based on real search queries and reader questions. If you landed here looking for something that is not covered, send us a note β€” if it is a genuine knowledge gap, it gets written.