2 Matching Annotations
- Sep 2018
-
nangkhieutin.com nangkhieutin.com
-
The numbers variable can reference an array of int values. Notice that this statement looks like a regular int variable declaration except for the set of brackets that appears after the key word int. The brackets indicate that this variable is a reference to an int array.
What differentiates an array variable from a regular variable is the set of brackets i.e []
-
As with any other type of object, it is possible to declare a reference variable and create an instance of an array with one statement. Here is an example:int[] numbers = new int[6];Arrays of any data type can be declared. The following are all valid array declarations:float[] temperatures = new float[100];char[] letters = new char[41];long[] units = new long[50];double[] sizes = new double[1200]
The arrays can have any data type e.g. char, string
-