Object orientation is an advance in how programmers think about their work. The OO approach leads to
software classes which more closely model the real world, and therefore make the application more natural
to think about. In addition, building classes usually leads to code which is more easily reused. Both effects lead
to better programming productivity.
CLASSES AND OBJECTS
People new to OO programming often have difficulty distinguishing what are called classes from what are
called instances. A class is a specification, a blueprint, or maybe even a concept, like vehicle; an instance is a
specific example of a class. From the class Automobile, one can build or identify particular cars. My Ford
with vehicle ID 1FABP64T1JH100161 is said to be an instance of the class Automobile.
Often the word object is used as a synonym for the word instance. One also says that my Ford is an object
of the class Automobile. This can be confusing, especially at first, because Java, like some other OO
languages, also recognizes a class called Object (capital O). In fact, every class in Java inherits from the class
Object (we will discuss inheritance soon); the class Object is the root of the Java class hierarchy. Though
the use of the word in two senses can be confusing, generally one should understand the word ???object??? to mean
???instance,??? unless the word ???Object??? is capitalized.
Pages:
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216