Why are Java arrays fixed length?
问题 int[] array = new int[10]; // Length is fixed when the array is created. The length of an array is established when the array is created. After creation, its length is fixed. Why does it have to be so? 回答1: As other answers have noted, fixed size is part of the definition, and you'd have to talk to the original authors to find the truth. But as a general point, it is significantly more complex to implement a variable-length container, and there are a number of strategies for achieving it