Why Arrays are Useful

  • Bunch of variables smashed together in an organized fashion
  • Reduces the number of variables you'll need to use
  • Can be sorted

Things to Note

  • Arrays have a different syntax than just creating a bunch of variables
  • You can cause errors by going outside the boundaries of Arrays (ArrayIndexOutOfBoundsException)
  • Arrays come in different forms: Arrays and ArrayLists
    • Arrays need to have their size defined before you can use them
    • ArrayLists don't need their size defined and can grow and shrink dynamically
  • Arrays are zero based (i.e. an item at position 0 is actually the FIRST item in the array, item at position 1 is the second and so on)

Multi-dimensional Arrays

  • Remember math class? Think of them like a matrix

Homework:

Read https://www.coderscampus.com/java-arrays/

Free Java Roadmap

Discover exactly what you need to learn and where to start in order to become a professional coder.