的基值在java中在打印时字符数组它给零指示字例外,但在整数数组的情况下,它打印空字符数组VS在Java int数组而打印阵列
public class Test {
char c[];
int a[];
//while printing c it gives null pointer exception
public static void main(String[] args) {
System.out.println(new Test().c);
// in case of integer it prints null
System.out.println(new Test().a);
}
}
什么问题 –
'println'重载为'char []',所以它的行为有所不同。 – 4castle
请详细解释。 –