单选题Given the following code:     public class Person{ static int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1];)     }     }  Which statement is correct?()AWhen compilation some error will occur.BIt is correct w

题目
单选题
Given the following code:     public class Person{ static int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1];)     }     }  Which statement is correct?()
A

 When compilation some error will occur.

B

 It is correct when compilation but will cause error when running.

C

 The output is zero.

D

 The output is null.


相似考题
参考答案和解析
正确答案: B
解析:  int型数组是类对象,它在类被加载时完成初始化,在前面题目中已经有叙述,由于是原始数据类型int,其初始值为0。