public class Quiz_2DArray {

public static String listToString(int[] list) {
String s = "";
for (int n : list) {
s = s + String.format("%4d", n);
}
return s;
}

/*
evaluateBoard() returns a new 2D-board with the same dimensions as the input 2D-board
Each square of the new board will be assigned the sum of its surrounding neighbors.
If a square at row r and column c is represented as board[r][c],
squares to its left use c-1
squares to its right use c+1
squares above use r-1
square below use r+1
Squares not on the board's edges have 8 neighbors BUT
Corner squares have 3 neighbors, and Non-Corner edge squares have 5 neighbors.
Therefore, you will need to check that a square's neighbor actually exists.
You do this by making sure that r-1, c-1, r+1 and c+1 - when used - are valid indexes.
*/
public static int[][] evaluateBoard(int[][] board) {
}

/*
initializeRandomBoard() fills each square of the 2D-board
with a random integer in the range 1-10 inclusive.
*/
public static void initializeRandomBoard(int[][] board) {
}

public static void main(String[] args) {
int[][] sampleBoard = {
{ 5, 4, 7, 6,10, 7, 3, 2, 4, 8 },
{ 1, 9, 2, 4, 6, 7, 8, 5, 7,10 },
{ 8, 4,10, 6, 2, 5, 3, 4, 7, 2 },
{ 7, 1, 6, 7, 7, 7, 7, 9, 7, 3 },
{ 3, 9, 5, 2, 4, 9, 5, 3,10, 9 },
{ 3, 5, 2, 4, 2, 7, 7, 1, 6, 6 },
{ 1, 2, 2, 7, 8, 3, 6, 3, 3, 7 },
{ 5, 6, 9, 2, 5, 2, 5, 8, 2, 6 },
{ 1, 4,10, 5, 4, 4, 9, 1, 6, 6 },
{ 5, 9, 8, 3, 5, 8, 2, 7, 7, 6 }
};

System.out.println("sampleBoard");
for (int[] row : sampleBoard) {
System.out.println( listToString(row) );
};
System.out.println();

System.out.println("sampleBoardEvaluated");
int[][] sampleBoardEvaluated = evaluateBoard(sampleBoard);
for (int[] row : sampleBoardEvaluated) {
System.out.println( listToString(row) );
};
System.out.println();
System.out.println();

/*****************/

int[][] randomBoard = new int[10][10];
initializeRandomBoard( randomBoard );
System.out.println("randomBoard");
for (int[] row : randomBoard) {
System.out.println( listToString(row) );
};
System.out.println();

int[][] randomBoardEvaluated = evaluateBoard(randomBoard);
System.out.println("randomBoardEvaluated");
for (int[] row : randomBoardEvaluated) {
System.out.println( listToString(row) );
};
}

}
Note I am using Eclipse
This is what the OUTPUT should look like.
sampleBoard
5 4 7 6 10 7 3 2 4 8
1 9 2 4 6 7 8 5 7 10
8 4 10 6 2 5 3 4 7 2
7 1 6 7 7 7 7 9 7 3
3 9 5 2 4 9 5 3 10 9
3 5 2 4 2 7 7 1 6 6
1 2 2 7 8 3 6 3 3 7
5 6 9 2 5 2 5 8 2 6
1 4 10 5 4 4 9 1 6 6
5 9 8 3 5 8 2 7 7 6

sampleBoardEvaluated
14 24 25 29 30 34 29 27 32 21
30 41 50 49 47 44 36 38 42 28
22 44 39 44 49 47 52 53 47 34
25 52 44 42 42 42 45 46 47 35
25 32 36 37 45 46 50 52 44 32
20 27 36 32 44 44 37 43 42 35
21 33 37 34 32 42 36 38 39 23
14 34 38 50 35 44 36 35 40 24
29 53 46 46 34 40 37 46 43 27
14 28 31 32 24 24 29 25 26 19

randomBoard (Note: the following will be different each run)
3 3 2 7 2 1 1 5 8 8
4 3 2 9 3 4 5 8 3 8
10 1 1 2 1 4 3 4 1 8
10 4 4 5 5 5 10 4 1 9
10 8 6 2 1 2 10 1 6 5
3 9 4 4 5 6 5 5 7 10
1 3 10 8 2 10 5 10 3 6
1 10 7 3 4 5 2 1 9 2
9 1 8 3 10 8 2 6 2 10
1 6 10 5 2 4 10 10 5 4

randomBoardEvaluated
10 14 24 18 24 15 23 25 32 19
20 26 28 20 30 20 30 30 50 28
22 38 30 30 37 36 44 35 45 22
33 50 29 22 22 36 33 36 38 21
34 50 40 34 34 47 38 48 42 33
31 45 50 38 35 40 49 47 46 27
26 45 48 39 45 34 44 37 50 31
24 40 46 52 49 43 47 39 40 30
19 52 45 49 34 39 46 41 47 22
16 29 23 33 30 32 30 25 32 17

To solve this problem, we need to implement the `evaluateBoard()` and `initializeRandomBoard()` methods.

Let's start by implementing the `initializeRandomBoard()` method. This method fills each square of the 2D-board with a random integer in the range 1-10 inclusive.

Here's an implementation for the `initializeRandomBoard()` method:

```java
public static void initializeRandomBoard(int[][] board) {
Random random = new Random();
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
board[i][j] = random.nextInt(10) + 1;
}
}
}
```

Next, let's implement the `evaluateBoard()` method. This method returns a new 2D-board with the same dimensions as the input 2D-board. Each square of the new board will be assigned the sum of its surrounding neighbors.

Here's an implementation for the `evaluateBoard()` method:

```java
public static int[][] evaluateBoard(int[][] board) {
int[][] evaluatedBoard = new int[board.length][board[0].length];

for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
int sum = board[i][j];

// Check neighbors to the left
if (j - 1 >= 0) {
sum += board[i][j - 1];
if (i - 1 >= 0) {
sum += board[i - 1][j - 1];
}
if (i + 1 < board.length) {
sum += board[i + 1][j - 1];
}
}

// Check neighbors to the right
if (j + 1 < board[i].length) {
sum += board[i][j + 1];
if (i - 1 >= 0) {
sum += board[i - 1][j + 1];
}
if (i + 1 < board.length) {
sum += board[i + 1][j + 1];
}
}

// Check neighbors above and below
if (i - 1 >= 0) {
sum += board[i - 1][j];
}
if (i + 1 < board.length) {
sum += board[i + 1][j];
}

evaluatedBoard[i][j] = sum;
}
}

return evaluatedBoard;
}
```

To test the code, we can use the `main()` method provided in the code snippet. The `main()` method initializes a sample board, prints it, evaluates the board using the `evaluateBoard()` method, and prints the evaluated board.

Make sure to import the `java.util.Random` class at the beginning of your code for the random number generation to work.

Hope this helps! Let me know if you have any further questions.