23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Note the uses of <strong>in</strong>stance variables <strong>in</strong> the Gnome example. The variables age,<br />

magical, <strong>and</strong> height are base types, the variable name is a reference to an <strong>in</strong>stance<br />

of the built-<strong>in</strong> class Str<strong>in</strong>g, <strong>and</strong> the variable gnomeBuddy is a reference to an<br />

object of the class we are now def<strong>in</strong><strong>in</strong>g. Our declaration of the <strong>in</strong>stance variable<br />

MAX_HEIGHT <strong>in</strong> the Gnome class is tak<strong>in</strong>g advantage of these two modifiers to<br />

33

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

Saved successfully!

Ooh no, something went wrong!