The for loop repeats code a known number of times. This tutorial explains the syntax of the Java for loop - initialization, condition and update - and traces exactly how it runs. It counts up, down and in steps, calculates a factorial, compound interest and an average, prints a multiplication table and a triangle with nested loops, shows variations of the loop header such as two counters, and covers common mistakes like off-by-one errors.