I want to initialize a 2d array in java which can hold different data types like char, int etc. My 2d array would be something like this -
1 2 3 4 5 6 7
1 S S S S S S S
2 S S S S S S S
3 S S S S S S S
4 S S S S B S S
5 S S S S S S S
6 S S S S S B S
7 S S S S S S S
There is a space before 1 and I want to include that in my array.If I can initialize that, how can I do that? Do I use ASCII convention while inputting the string values or something? Please help. Note - I don't want to print the matrix, I will input these values manually.
char2D array here. Of course, using 2D array of raw objects is possible, but in this case you cannot be sure which type is stored in each cell of the array.