给出下面代码,那个语句是正确的?
public class Test{
static int arr[] = new int[10];
public static void main(String a[]) {
System.out.println(arr[1]);
}
定义时,没有指定数组的大小编译时将产生错误
编译虽然正确,但因为没有给定初始值,运行时将产生错误;
编译,运行都正确,输出零;
编译,运行都正确,输出空
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题