Tic Tac Toe game is a paper-and-pencil game for two players, noughts and crosses (Xs and Os), who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a diagonal, horizontal, or vertical row is the winner.
Now, no need to waste paper to play Tic Tac Toe game! You can play Tic Tac Toe on your Desktop in console/any IDE for free.
java. util is a package and part of Java class library.
util package contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
All the classes and interfaces used in this game are from util package only.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.Scanner;We will be using these position numbers to play this game. Since the Tic Tac Toe game is a 3X3 matrix, that's why 9 positions will be there to play the game. The player can select any value between 1 to 9.






