I am given:
static String[] initStrings =
{
"...../...\\",
"..\\.......",
"......./..",
"..........",
"........\\.",
"..........",
"..........",
".....\\../.",
"..\\....../",
".........."
};
and something like this:
static char[][] squares =
{
};
Now, I need to write a method that will copy each character from each initStrings string into squares array. So far I have this:
public static void initialize()
{
int lengR = initStrings.length;
int lengC = initStrings[0].length();
squares = new char[lengR][lengC];
for(int i=0; i<lengR;i++)
{
squares[i] = initStrings[i].toCharArray();
}
}
I am very new to this and I'm pretty sure my for loop is wrong.. I don't see any errors so far, but I just don't understand how my initialize method would work. How do you convert 1-dimensional String array to 2-dimensional Char array? Please help me out.. :(