I have got two arrays. One for initializing and another for displaying. The display array always shows nothing if the initializing array has not been called. The problem now though is that if I want to insert something in a certain slot in the array nothing happens and I dont know why. Here is a sample code of my 3 arrays.
public void arr1(String[][] arr)
{
for(int i=0;i<arr.length;i++)
{
for (int j=0;j<coordinates[i].length;j++)
arr[i][j]=" . ";
// arr[x][y]=" # "; //this seems to work but it is not what i want
}
}
public void arr3()
{
Class obj = new Class ();
x=obj.getX();//gets input from a certain class
y=obj.getY();
for(int i=0;i<arr.length;i++)
{
for (int j=0;j<arr[i].length;j++)
arr[x][y]="#";//doesnt work
}
}
public void arr3(String[][] arr)
{
for(int i=0;i<arr.length;i++)
{
for (int j=0;j<coordinates[i].length;j++)
System.out.print(" "+arr[i][j]);
System.out.println();
}
}
The above code does not compile because I will have to post the whole code here. I hope this is enough for me to get the help I need. Thanks