Java For Loop Examples
✅ Java For Loop Examples
The for loop is commonly used when the number of iterations is known. Below are multiple practical examples.
📌 Example 1: Print 1 to 10
📌 Output:
📌 Example 2: Print Even Numbers
📌 Output:
📌 Example 3: Reverse Countdown
📌 Output:
📌 Example 4: Multiplication Table
📌 Output:
📌 Example 5: Sum of First 10 Numbers
📌 Output:
📌 Example 6: Loop Through an Array
📌 Output:
📌 Example 7: Nested For Loop (Pattern)
📌 Output:
🧠 Summary
| Example Type | Purpose |
|---|---|
| Counting | Print numbers sequentially |
| Even Numbers | Increment pattern |
| Countdown | Reverse iteration |
| Multiplication Table | Pattern multiplication |
| Sum | Accumulation logic |
| Array Iteration | Access array elements |
| Nested Loop | Print patterns |
