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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started