- arrays are Java objects
- all Java arrays are technically one-dimensional. Two-dimensional arrays are arrays of arrays.
- declaring an array does not create an array object or allocate space in memory; it creates a variable with a reference to an array
- array variable declarations must indicate a dimension by using []
// declares an array of integers
int[] anArray;
// allocates memory for 10 integers
anArray = new int[10];
Accessing Arrays
int arrval[]= new int[10];
ArrayList<Object> arrList= new ArrayList();
for (int a: arrval) {
}
for (Object obj : arrList) {
}
No comments:
Post a Comment