Is it possible to use many simple array values to declare as multidimensional array values?
char[] alpha1 = {"A","B","C","D","E"};
char[] alpha2 = {"F","G","H","I","J"};
//Is it possible? Give me a solution for this situation:
char[][] alpha = { alpha1[] , alpha2[] };
With " "
you declare a String. Use ' '
for a character.
But yes it is possible, but you have to remove []
:
char[] alpha1 = {'A','B','C','D','E'};
char[] alpha2 = {'F','G','H','I','J'};
char[][] alpha = { alpha1 , alpha2 };
There are a couple of ways to declare multidimensional array:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.