initialize java array vs other initialization?

后端 未结 5 1137
太阳男子
太阳男子 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:38

    I guess the guys who created Java wanted to keep a syntax close to the C syntax. In Java, arrays are minimalist low-level objects, so their case is a bit particular.

提交回复
热议问题