Ayúdanos a dar forma a GoConqr. ¿Qué deberíamos añadir?

Mapa mental

Array

Tate Johnson Computer Science Inglés

Mind map about Java arrays: declaring arrays, indexing with for-each, two dimensional arrays and copying arrays

Mind map: Java arrays

Contenido del mapa

Array

  1. Very similar to dictionaries in Python

    • The size of an array can't be change
  2. 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}
  3. Indexing through an array: for-each loop

    • Example: for(elementType element: nameofArray)
      • for(double d1: stringHolder)
  4. Two Dimensional Arrays

    • Declare: int[][] array2d;
      • array2d = new int[3][10]
  5. 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
array
Valoración

Más sobre Arrays

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué deberíamos añadir?