标签:http sp c new ef bs r as tt
来源:http://www.imooc.com/ceping/1595
下列数组的初始化正确的是()
A int[ ] score = new int[ ];
B int score[ ] = new int[ ] { 34, 90, 87, 54, 24 };
C int[ ] score = new int[ 4 ] { 90, 12, 34, 77 };
D int score = { 78, 23, 44, 78 };
答案:B
选项 A 需要指定数组的长度;选项 C 在声明数组的同时赋值时不能指定数组长度;选项 D 声明数组的语法错误,应为int[ ] score={ 78, 23, 44, 78 };因此选择 B
标签:http sp c new ef bs r as tt
原文地址:http://www.cnblogs.com/chenliting/p/3960892.html