how can I make a String from a 2 dimensional char array?

66 Views Asked by At

I have an inhomogenous 2 dimensional

char[][] array = {{'t', 'o', 'b', 'i', 'a', 's'},
                  {'h', 'e', 'i', 'n', 'd', 'e', 'l'},
                  {'1', '2', '1', '6', '3'}};

my return should be a String like this:

tobias heindel 12163

how should I do that?

1

There are 1 best solutions below

1
Jyrios On

You just have to create 2 loops that increase i from 0 to your array size and y from 0 to current array (its index represented by i) size where i is the current array and y is the char position at the current array.