Help shape GoConqr. What should we add next?

Mind map

Array

Tate Johnson Computer Science English

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

Mind map: Java arrays

Map content

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.

Information

Description
Computer Science Mind Map on Array, created by Tate Johnson on 27/04/2021.
Created by
Tate Johnson
Views
59
Tags
array
Rating

More on Arrays

Feedback

What is it about?

What should we add next?