array = new int[] {42};
This line creates a new integer array with size 1, whose only element is 42, and assigns it to array. It is equivalent to
array
array = new int[1]; array[0] = 42;
548k questions
547k answers
4 comments
86.3k users