Explanation :

variable currentSymbol stores the symbol of the active player in it

When we run the program "startPlay()" method is called which prints the board.

In that method there is a for loop which iterates from 0 to less than 9. On line# 37 we check if the iteration is even or odd(even for player1 and odd for player2) if its even the "currentSymbol" is set equal to "player1Symbol" and if its odd "currentSymbol" is set equal to "player2Symbol".

After that the player selects a box to fill and the currentSymbol is printed in the selected box if the selected box is empty. If the selected box is not empty the current iteration is repeated and the player is asked again to select a box. Then the board is printed again then. Then the process repeats until the iteration = 4.

Deciding Winner:

When Iteration becomes Equal to 4(i.e five boxes are filled)then the decidewinner method is called to check if someone Won? In decide Winner Method we have if conditions checking for all winning combinations(i.e (1,2,3),(1,4,7),(4,5,6),(7,8,9),(2,5,8),(3,6,9),(1,5,9),(3,5,7)) . If someone has won then the loop is broken and the message showing that the current player has won is displayed.