initialize java array vs other initialization?

后端 未结 5 1135
太阳男子
太阳男子 2021-01-28 05:05

I know that when I initialize a char array: I have to

char[] b= new char[5];

or

char[] b= new char[5]({1,2,3,4,5});
         


        
5条回答
  •  [愿得一人]
    2021-01-28 05:46

    That's is simply design of Java. ArrayList and Arrays are two different things. No need to be same declaration.

提交回复
热议问题