8. Classes and Objects: A Deeper Look

Is it a world to hide virtues in?

—William Shakespeare

But what, to serve our private ends, Forbids the cheating of our friends?

—Charles Churchill

This above all: to thine own self be true.

—William Shakespeare.

Objectives

In this chapter you’ll:

Image Use the throw statement to indicate that a problem has occurred.

Image Use keyword this in a constructor to call another constructor in the same class.

Image Use static variables ...

Get Java™ How To Program (Early Objects), Tenth 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.