Can someone tell me why am I getting compilation error for explicitly setting NULL
value to an array element?
int[] a = new int[5];
a[0] = 1;
a[2] = 'a';
a[3] = null; //Compiler complains here
for (int i : a) System.out.println(i);
I am assuming because its an int array and the literal value allowed is 0
and not NULL
. Am I right?