Why passing {a, b, c} to a method doesn't work?
问题 I've tried to pass an initialization list {...} to a constructor and it didn't work. When I instead declared it in a method local variable (int[]) it worked flawlessly. Why is that? public class QuickSort { int[] a; public QuickSort(int[] a) { this.a = a; } public static void main(String[] args) { // ################### // ### WORKS ## // ################### int[] a = {8,12,79,12,50,44,8,0,7,289,1}; QuickSort sort = new QuickSort(a); // ################### // ### DOESN'T WORK ## // ##########