Java: Why can't return array using {..} without new operator?

前端 未结 5 659
忘掉有多难
忘掉有多难 2021-01-04 05:58

I have searched a lot on the website, but didn\'t find any related question. So I believe it is not a duplicate.

I know we can initialize an array with 3 ways:

5条回答
  •  星月不相逢
    2021-01-04 06:58

    1. Syntactic Sugar
    2. The compiler fills it in, because it is able to deduce it
    3. Because on a return line the language doesn't provide that syntactic sugar

提交回复
热议问题