Practical Coding in Java

Learn to write and validate your own code

Darren Kessner, PhD

(revised January 9, 2026)

Previous: Coding Exercises: Inheritance and Interfaces

10. 2D Arrays

In this chapter we look at 2D arrays. In Java, a 2D array is an array of arrays. This is a simple idea, but there are some details that we will explore in the examples and exercises.

2D arrays have many applications. In particular, 2D arrays are a natural way to store pixel data for images.

In the exercises you will practice initializing, traversing, and performing computations on 2D arrays.


Next: