Can any one clarify me the part of below statement on primitive arrays from K&B.
"if you declare an int array, the reference variable you declare can be reassigned to any int array of any size, but cannot be reassigned to anything that is not an int array, including int value" from this I have understood int i; int i1=new int; byte b=new byte; ==> i=i1; //valid statement. ==> i=b; // invalid bcos though byte can fit in int, in arrays it is not possible. here it continues the statement--- "including int value" putting me in confusion state. explanation will be appreciated.
The reason that you can NOT assign primitive to array lies to the fact that arrays are objects even they are declared as primitives the array itself is an object and therefore it is not possible to assign primitives to objects.