I was reading a tutorial about 2D arrays and I decided to construct something. I managed to construct something but when I compile I get "null" as my output. I cant seem to figure out the problem. Here is the sample code. I have also higlighted in red a line I dont understand because even if I seem to put the actual value i.e 10 it works well, so if someone can also explain that to me then I'd appreciate that. Thanx
Class A{
public void in(String[][] arr)
{
for(int i=0;i<arr.length;i++)//cannot understand this part
{
for (int j=0;j<arr[i].length;j++)//cannot understand this part
arr[i][j]=".";
}
}
public void out(String[][] arr)
{
for(int i=0;i<coordinates.length;i++)
{
for (int j=0;j<arr[i].length;j++)
System.out.print(arr[i][j]);
System.out.println();
}
}
}
Class B{
public static void main (String[] args)
{
String [][] arr=new String[10][10];
obj.out(arr);
}
}