public class Map { int Position; int[][] Grid = new int [16][16]; void Map() { f
ID: 3637422 • Letter: P
Question
public class Map {int Position;
int[][] Grid = new int [16][16];
void Map()
{
for (int i=0; i<16; i++)
{
Grid[i] = new ; IVE GOT A RED LINE HERE WHAT DO I PUT IN IT
}
}
// ALL DATA FIELDS ARE SET
// position get and set below
public void setPosition(int newPositionValue)
{
Position = newPositionValue;
}
public int getPosition()
{
return Position;
}
// GET AND SET INT GRID
public void setGrid(int row, int col, int newGridValue)
{
Grid[row][col] = newGridValue;
}
public int getGrid(int row, int col)
{
return Grid[row][col];
}
}
IVE GOT A RED LINE IN MY CODE NEXT TO gRID [I] = NEW PLEASE CAN YOU TELL ME WHAT I PUT IN THERE.
THANK YOU
Explanation / Answer
dear u have decleared new as a two dimensional array and u are now alloting the value it should be like Grid[i][i] = new [i][i]; or if u want differnt the you should use two loops.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.