Methods, arrays and strings

Writing static methods, arrays and two-dimensional arrays, and working with strings and StringBuilder.

About 5 hours of study

Learning objectives

Lessons

  1. 1

    Methods

    Writing static methods with parameters and return types, void methods, overloading, recursion with a base case, and why Java passes arguments by value.

  2. 2

    Arrays

    Creating and filling arrays, indexes and length, looping with for and enhanced for, the Arrays helper class, references to arrays, default values, and two-dimensional arrays.

  3. 3

    Strings and StringBuilder

    Working with text: String methods, immutability, comparing with equals instead of ==, characters and char arithmetic, splitting and joining, building text efficiently with StringBuilder, and String.format.

Module practice

Module quiz

1. What does a void method return?
2. What is the last index of an array of length 5?
3. How should two strings be compared for equal text?
4. What is method overloading?
5. Why use StringBuilder in a loop that builds text?
6. A method changes an element of an array parameter. Does the caller see the change?

‹ Java basicsObject-oriented Java ›