Can someone guide me through this example so it makes sense to me?

By the looks of your output, it seems like the value of upTo=5.

Tracing the method print():

The for loop runs from i=1 to i=5.

For each iteration, the printMultiplicationTableRow() method is called.

  1. When i=1 and upTo=5:
    printMultiplicationTableRow(i,upto) is called which means that the values 1 and 5 are passed as parameters to the method printMultiplicationTableRow( int multiplier, int howManyTimes ). This means that printMultiplicationTableRow(1,5) is called which means that multiplier has the value 1, and howManyTimes has the value 5.
    The loop within the printMultiplicationTableRow() runs from i=1 to i<=5.
    For each iteration: System.out.print(i * multiplier + " ") is called.
    Values printed out will be
    1*1 1*2 1*3 1*4 1*5
    Control is passed back to the print method which prints out a new line.

  2. i=2 and upTo=5:
    printMultiplicationTableRow(i,upto) is called which means that the values 1 and 5 are passed as parameters to the method printMultiplicationTableRow( int multiplier, int howManyTimes ). This means that printMultiplicationTableRow(1,5) is called which means that multiplier has the value 1, and howManyTimes has the value 5.
    The loop within the printMultiplicationTableRow() runs from i=1 to i<=5.
    For each iteration: System.out.print(i * multiplier + " ") is called.
    Values printed out will be
    1*1 1*2 1*3 1*4 1*5
    Control is passed back to the print method which prints out a new line.

/r/learnjava Thread