# Sample Code
## TicTacToe
```java
public class TicTac {
public static void main (String args []) {
String [][] board = new String [3][3];
for (int down = 0; down < 3; down++) {
for (int across = 0; across < 3; across++) {
board[down][across] = "*";
}
}
for (int down = 0; down < 3; down++) {
for (int across = 0; across < 3; across++) {
System.out.print(board[down][across]);
}
System.out.println("");
}
}
}
```
# Exercises
1. Look at the sample code for TicTacToe. Adapt the code to print out an 8 x 8 grid
2. Create and print out a 3x3 array as follows
| | |
| ----- |----- |----- |
| Y | * | * |
| * | E | * |
| * | * | S |
1. Create and print out a 3x3 array as follows
| | |
| ----- |----- |----- |
| J | A | V |
| A | R | O |
| C | K | S |
1. Create and print out an 8x8 array filled with vertical stripes…
| | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
| | * | | * | | * | | * |
1. Create and print out an 8x8 array filled with a chessboard pattern…
| | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- |
| | * | | * | | * | | * |
| * | | * | | * | | * | |
| | * | | * | | * | | * |
| * | | * | | * | | * | |
| | * | | * | | * | | * |
| * | | * | | * | | * | |
| | * | | * | | * | | * |
| * | | * | | * | | * | |
1. Create a Deck of Cards
1. Create two arrays, `String [] suit = {"C","D","H","S"};` and `String [] value = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};`
2. Create a third array, String [] deck.
3) Use nested for loops to fill deck with the values of a deck of cards, ie {"AC","2C","3C", … )
4) Print out the array