Question: JAVA question -- Error I am creating a Snakes and Ladder Game. I am trying to create the game board. This game board is to

JAVA question -- Error

I am creating a Snakes and Ladder Game. I am trying to create the game board. This game board is to display a numbered board from 1-100. It is a 10x10 board.

In my driver class, I have:

public class Play { public static int[][] board = new int[10][10];

public static void main(String[] args) { System.out.println(Board.fillBoard(int[][]));

}

My Board object class is the following:

public class Board { private boolean ladder; private boolean snake; Board(){ snake = false; ladder = false; } public static void fillBoard(int[][] a) { int counter = 1; for (int i = 0; i <= a.length; i++) { for (int j = 0; j <= a[i].length; j++) a[i][j] = counter; counter ++; } }

----

With this code I am getting an error in the : System.out.println(Board.fillBoard(int[][]));

this is located in the driver.

There error says:

The method fillBoard(int[][]) in the type Board is not applicable for the arguments (Class)

---

How can I fix this error to create a numbered board (2d array) that is the dimension 10 X 10.

Please try to solve my error and suggest an alternative more efficient method if one exists (I am a beginner so please keep it in the scope of beginner knowledge if you are also going to suggest )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!