09.04.2016 Views

www.ebook777.com

Make_Getting_Started_with_Processing_Second_Edition

Make_Getting_Started_with_Processing_Second_Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

158 Getting Started with Processing<br />

<strong>www</strong>.<strong>ebook777.com</strong><br />

Figure 11-2. Shifting the values in an array one place to the right<br />

Arrays of Objects<br />

The two short examples in this section bring together every<br />

major programming concept in this book: variables, iteration,<br />

conditionals, functions, objects, and arrays. Making an array of<br />

objects is nearly the same as making the arrays we introduced<br />

on the previous pages, but there’s one additional consideration:<br />

because each array element is an object, it must first be created<br />

with the keyword new (like any other object) before it is assigned<br />

to the array. With a custom-defined class such as JitterBug<br />

(see Chapter 10), this means using new to set up each element<br />

before it’s assigned to the array. Or, for a built-in Processing

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!