Is it faster (or better) to declare an array inline in Java?

前端 未结 7 1257
慢半拍i
慢半拍i 2021-01-11 17:20

Consider the following two method calls that are nearly equivalent. Take note of the way the byte array is declared and allocated on both.

void Method1()
{
          


        
7条回答
  •  误落风尘
    2021-01-11 18:03

    Its better to use the first style.

    On the Second style i try to find a non-0. Its guarantees more error-free, and therefore better readable.

    This shorthand has a good reason to be exists!

提交回复
热议问题