When viewing the source file, I saw two ways to initialize the array. I wonder if there is a difference between
int[] value = new int[0];
and
int[] value_next = new int[]{};
?
There really is no difference. This is Syntactic sugarin the java array declaration.
Syntactic sugar
The declaration of the first type is less confusing, at least for me :).
Note. I'm not sure why you specified the length as zero when declaring.
If possible, go to fooobar.com/questions/2086212 / ... for some advantages over others.
Now the proof (and exercise):
, . , .class.:
javap -c yourClass
-.
.
int[] a = new int[0] , .
int[] a = new int[0]
, [].
[]
int[] value_next = {} .
int[] value_next = {}
-, int[] value = new int[0]; , 0. 3 .
0
, .
0 .