9

Arrays

I might repeat to myself slowly and soothingly, a list of quotations beautiful from minds profound—if I can remember any of the damn things.

—Dorothy Parker

In this chapter:

 What is an array?

 Declaring an array

 Initializing an array

 Array operations – using a for loop with an array

 Arrays of objects

9-1 Arrays, why do you care?

Let’s take a moment to revisit the car example from the previous chapter on object-oriented programming. You may remember I spent a great deal of effort on developing a program that contained multiple instances of a class, that is, two objects.

Car myCar1;

Car myCar2;

This was indeed an exciting moment in the development of your life as a computer programmer. It’s likely, however, that you’re contemplating a somewhat ...

Get Learning Processing, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.