Mapa mental
Array

Mind map: Java arrays
Contenido del mapa
Array
Very similar to dictionaries in Python
- The size of an array can't be change
How to declare/instantiate: elementType[] varName = new elementType[arraySize];
- Example:String[] stringHolder = new String[5]
- Setting the values of an array: varName[index] = value;
- Checking the length: varName.length (no parentheses)
- Can also initialize it like this: String[] stringHolder = {value1, value2, value3}
Indexing through an array: for-each loop
- Example: for(elementType element: nameofArray)
- for(double d1: stringHolder)
- Example: for(elementType element: nameofArray)
Two Dimensional Arrays
- Declare: int[][] array2d;
- array2d = new int[3][10]
- Declare: int[][] array2d;
Copying Arrays:
- Use a loop to copy the individual elements
- use static arraycopy method in System class
- arraycopy(sourceArray, sourcePosition, targetArray, targetPosition, length)
- Use clone method to copy arrays.
Información
- Descripción
- Computer Science Mapa Mental sobre Array, creado por Tate Johnson el 27/04/2021.
- Creado por
- Tate Johnson
- Visitas
- 59
- Etiquetas
- Valoración