📚 Java Multiplication Table - Fixed Enhanced Loop Visualization

✅ FIXED: The enhanced for-each loop now properly highlights ALL cells in purple, including the last row and column! Previously, the last cell (row 2, col 3 in a 3x4 table) wasn't being highlighted.
👨‍🎓 Student's Code (Enhanced For-Each Loop): for (int[] row : table) { for (int value : row) { System.out.print(value + "\t"); } System.out.println(); }

✨ This loop automatically iterates through each row and each value without using indices!

🔧 Controls

Click "Initialize Array" to begin

📝 Java Code - Phase 3: Printing with Enhanced For-Each (Student's Code)

20
21 // PHASE 3: Print using enhanced for-each loops
22 for (int[] row : table) {
23 for (int value : row) {
24 System.out.print(value + "\t");
25 }
26 System.out.println();
27 }

â„šī¸ Execution State

rows: -
columns: -
current row array: -
current row index: -
current value: -
current col index: -
cell position: -
Loop Status: Not started
Console Output:

📊 Multiplication Table

🔷 Traditional For Loops

for (int i = 0; i < rows; i++) {
    for (int j = 0; j < columns; j++) {
        // Access using indices
        table[i][j] = ...
    }
}

✅ Gives you access to indices (i, j)
✅ Can modify array elements

💜 Enhanced For-Each Loops (Student's Code)

for (int[] row : table) {
    for (int value : row) {
        // Direct access to values
        System.out.print(value);
    }
}

✅ Cleaner, more readable
✅ No indices to manage
❌ Cannot modify array elements
❌ No direct index access

📖 How Enhanced For-Each Works:
â€ĸ for (int[] row : table) - Gets each entire row array one by one
â€ĸ for (int value : row) - Gets each value in the current row one by one
â€ĸ The loop automatically knows when to start the next row
â€ĸ Purple cells show values that have been printed
â€ĸ Blue cell shows the current value being printed