Often you actually want to play the computer in a game since sometimes there is not a human around to play the role of opponent. This applet will actually make moves on its own for the X player and you get to be the O player. Notice that there is not any delay of any kind when the computer makes a move. A nice feature to add would be some kind of delay to give the impression that the computer is thinking about its move.
As you probably noticed, the moves made by the computer in this applet are random. The computer uses no strategy at all when deciding on its move. It just randomly generates possible moves until it finds an empty cell to fill. In order to randomly generate numbers we must use the Random class which is part of the java.util package which we must load with the other packages.
ASSIGNMENT: