回 帖 发 新 帖 刷新版面

主题:求助!

The statement int [] counts = new int [26];
A)    Creates a pointer to an integer array, but doesn't actually allocate any memory for it. A maximum size of 26 numbers is set for later use
B)    Creates an array object that can hold up to 26 whole numbers
C) Creates an array object, initially with enough memory allocated to hold 26 numbers. But this will be extended automatically if you go past the end of the array
C)    Creates an array object that can hold up to 27 whole numbers (positions 0 through 26)        

回复列表 (共3个回复)

沙发

What can i do for you?

板凳

我只看的懂右边是建立一个可以有26个成员的整形数组,是动态开辟的,左边的counts看不懂

3 楼

C)    Creates an array object that can hold up to 27 whole numbers (positions 0 through 26)
语句:int[] counts = new int[26];
A)创建一个指向int数组的指针,但不分配内存留给以后使用。
B)创建一个数组,可以容纳26个数
C)创建一个数组并分配足够容纳26个数的内存。但是当索引越过下标最大值的时候自动扩展(extend是扩展的意思。这里大概是说允许下标越界并读取最后一个元素后面的内存数据)
D)创建一个数组,可以容纳27个数(下标0~26)

我来回复

您尚未登录,请登录后再回复。点此登录或注册