1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
skad [1K]
4 years ago
9

Create a TicTacToe class that initializes a 3x3 board of "-" values. We will use this class in future exercises to fully build o

ut a Tic Tac Toe game! The TicTacToe class should have a 2D array as an instance variable and a constructor that initializes the 2D array with the "-" value. Add a getter method that returns the private 2D instance variable.
Computers and Technology
1 answer:
kap26 [50]4 years ago
8 0

Answer:

public class TicTacToe //Defining TicTacToe class

{

char board[3][3] ; //Creating a 2D array instance variable

TicTacToe() //Constructor to initialize the array with " - "

{

for( int i = 0;i<3;i++) //Loop for the row of array

{

for(int j = 0;j<3;j++) //Loop for the column of array

{

Board[i][j] = '-'; //Assigning "-" in each cell

}

}

}

public char getter() //Defining getter() method to return the array

{

return Board; //returning the array

}

}

You might be interested in
What type of selection can be used in leu of switch/case?
tankabanditka [31]
An if or else statement can be
7 0
3 years ago
Read 2 more answers
What is it called when a user makes a typing error when entering a url that takes him to an imposter website?
Shtirlitz [24]
It’s called a typo squatting
6 0
3 years ago
What is the function of ctrl+Q​
vlabodo [156]

Answer:

Ctrl+Q is used to remove a paragraph's formatting

Explanation:

Hope that's the answer you're looking for!

5 0
3 years ago
While using the CLI on a Windows 10 64-bit computer with a single HDD and a single volume, you want to move from the current dir
dimulka [17.4K]

Answer:

50-64

Explanation:

We know this because I said so

5 0
4 years ago
Complete the sentence with the correct response. In a two-way selection, if the initial statement is evaluated as , the code ski
mestny [16]

Answer:

True.

The code skips the else command

Explanation:

I will answer this question with the following code segment

<em>n = 1</em>

<em>If n > 0:</em>

<em>   Print("greater than 0")</em>

<em>else:</em>

<em>   Print("not greater than 0")</em>

<em />

From the code segment above

<em>Print("greater than 0")</em> will be executed because the condition <em>If n > 0 </em>is true

Since the if condition is true, the else condition will not be executed

8 0
3 years ago
Other questions:
  • If a CPU receives theinstruction to multiply the byte-sized values $12 and $3E, thisaction will take place in the ______________
    13·1 answer
  • The range A2:B4 has how many cells?   A. 2   B. 4   C. 6   D. 8
    11·2 answers
  • What is the name of a button on a website?
    11·1 answer
  • Which of the following résumés would most likely get thrown in the garbage?
    15·2 answers
  • The ____ method writes a newline character after the data.
    11·1 answer
  • What is the most vulnerable information that should be protected to prevent unauthorized access to your online files and records
    8·1 answer
  • How has the dependence on technology made humanity less intelligent?​
    15·1 answer
  • Which of the following events happened first
    15·2 answers
  • Components of document merging?
    5·1 answer
  • A palindrome is a string whose reversal is identical to the string. how many bit string of length 20 are palindromes and do not
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!