What is the difference in adding the [] to an ArrayList a
, as opposed to initializing like ArrayList b
? Is there any purpose for one way or the other?
ArrayList<Integer> a[];
ArrayList<Integer> b;
What is the difference in adding the [] to an ArrayList a
, as opposed to initializing like ArrayList b
? Is there any purpose for one way or the other?
ArrayList<Integer> a[];
ArrayList<Integer> b;
ArrayList<Integer> b;
is declaring a reference to an array list that contains integers, named b.
ArrayList<Integer> a[];
is declaring a reference to an array of array lists that contain integers, named a.
ArrayList<Integer> a[]
is the same as ArrayList<Integer>[] a
.