1int intArray[]; //declaring array
2intArray = new int[20]; // allocating memory to array
3//OR
4int[] intArray = new int[20]; // combining both statements in one
1String[] cars = new String[4];
2cars[0] = "Volvo";
3cars[1] = "BMW";
4cars[2] = "Ford";
5cars[3] = "Mazda";
1// ! IMPORTANTE !
2// in JAVA an array is not the same as an ArrayList object!!
3// 1 - declare, instanciate and populate
4int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
5// 2 - declare and instanciate an int array with maxSize
6// note: the index goes between 0 and maxSize-1
7int newarr[] = new int[maxSize];
8// 2.1 - insert the value n on the position pos
9newarr[pos] = n;
10// 2.2 - insert values recursively
11for (i = 0; i < maxSize; i++) { newarr[i] = arr[i]; }