Declaring a Variable to Refer to an Array
by, 03-04-2012 at 10:02 AM (428 Views)
Array is declared in the above program along with this line of code.
Array declaration also consists of 2 components, just like other declarations for other types of variables. They areJava Code:// declares an array of integers int anArray;
- Array’s name
- Array’s type
Array’s type is written as type.
An array’s name could be anything that you may want provided it follows the conventions. Just like other type variables, array is not actually created by the declaration- this shows that variables would be holding specified type array.
In same way, the other types array could be declared.
Java Code:byte anArrayOfBytes; short anArrayOfShorts; long anArrayOfLongs; float anArrayOfFloats; double anArrayOfDoubles; boolean anArrayOfBooleans; char anArrayOfChars; String anArrayOfStrings;