Java · Beginner level

Beginner level · Module 3 of 5 · 10 guided hours

Arrays, Strings and ArrayList

Store many values in arrays and ArrayLists, process them with loops, and work with text using String methods.

Learning objectives

  • Create arrays and process them with loops
  • Use common String methods to clean and compare text
  • Use ArrayList for lists that grow and shrink

Topics

  • array declaration and indexing
  • enhanced for loop
  • searching and totals
  • String methods
  • StringBuilder
  • ArrayList and wrapper types

Lessons

  1. Lesson 1 Arrays and Array Algorithms

    Store a fixed number of values in an array and use loops to total, average, search and find the largest value.

    index from 0lengthenhanced forArrayIndexOutOfBoundsException

  2. Lesson 2 Working with Text: String and StringBuilder

    Clean, compare, split and build text with String methods, and know why Strings are immutable.

    immutable StringequalsIgnoreCasesplitStringBuilder

  3. Lesson 3 Growing Lists with ArrayList

    Use ArrayList when the number of items is not known in advance, and understand wrapper types such as Integer.

    ArrayList<E>add/get/set/removesize()wrapper types and autoboxing

Practical activity

Process a class register: store names and marks, calculate the class average, find the top student and list students below the pass mark.

Expected outcomes

  • Correct processing of collections of data with loops
  • Clean handling of text input

Assessment

Practical: given an array of daily sales, write methods for total, average, maximum and the day it occurred; marked by automated test inputs.

Free taster lesson Arrays & Basic Collections Read a free self-study lesson on this topic in the Free Course Library.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.