I am attempting to make an char array which holds multiple char arrays. Below is the method, when I run it I get a error that says "char[] can not be converted to char":
private MazeStatus[][] stringToMaze(String sMaze) {
String[] splitString = sMaze.split("\n");
char[][] array = new char[1][];
for (int x = 0; x < splitString.length; x++) {
array[1][x] = splitString[x].toCharArray();
}
return null; // TO DO
}
How do I make it so that it holds char arrays apposed to just chars?
I have searched stack overflow for similar question and found one with the same title as mine. One of the answers were this:
String[][] arrays = { array1, array2, array3, array4, array5 };
I understand the above method, however I am not able to do that as I first have to loop through the string array, convert each String in the array to a char array and then can I only add it to the array that holds arrays (which I am not sure how to do without initializing it with the arrays as the above answers says)