5.1 Class and Method Definitions
Concentrate all your thoughts upon the work at hand. The sun’s rays do not burn until brought to a focus.
—ALEXANDER GRAHAM BELL, How They Succeeded, Orson Swett Marden, (1901)
A Java program consists of objects of various class types, interacting with one another. Before we go into the details of how you define your own classes and objects in Java, let’s review and elaborate on what we already know about classes and objects.
Objects in a program can represent either objects in the real word—like automobiles, houses, and employee records—or abstractions like colors, shapes, and words. A class is the definition of a kind of object. It is like a plan or a blueprint for constructing specific objects. For example, ...
Get Java: An Introduction to Problem Solving and Programming, 8th 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.