> array variables in java ~ Online tutorial

array variables in java

Array Variables

  • A variable of array type holds a reference to an object.
  • Declaring a variable
    of  array type does not create an array object or allocate any space for array components.
  • It creates only the variable itself, which can contain a reference to an array.
  • However, the initializer part of a declarator  may create an array, a reference to which then becomes the initial value of the variable.
  • Because an array’s length is not part of its type, a single variable of array type may contain references to arrays of different lengths.
  • Here are examples of declarations of array variables that do not create arrays: int[] ai; // array of int short[][] as; // array of array of short Object[] ao, // array of Object otherAo; // array of Object Collection[] ca; // array of Collection of unknown type short s, // scalar short aas[][]; // array of array of short

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: