Java Reference
In-Depth Information
This doesn't mean you are going to jump in with all the precise nitty-gritty of Java that you need for de-
scribing and using objects. You are just going to get the concepts straight at this point. You do this by taking
a stroll through the basics using the odd bit of Java code where it helps the ideas along. All the code that you
use here is fully explained in later chapters. Concentrate on understanding the notion of objects first. Then
you can ease into the specific practical details as you go along.
So What Are Objects?
Anything can be thought of as an object. Objects are all around you. You can consider Tree to be a particular
class of objects: trees in general. The notion of a Tree in general is a rather abstract concept — although any
tree fits the description, it is more useful to think of more specific types of tree. Hence, the Oak tree in my
yard which I call myOak , the Ash tree in your yard which you call thatDarnedTree , and a generalSherman ,
the well-known redwood, are actual instances of specific types of tree, subclasses of Tree that in this case
happen to be Oak , Ash , and Redwood . Note how we drop into the jargon here — class is a term that describes
a specification for a collection of objects with common properties. Figure 1-3 shows some classes of trees
and how you might relate them.
A class is a specification, or blueprint — expressed as a piece of program code — that defines what goes
to make up a particular sort of object. A subclass is a class that inherits all the properties of the parent class,
but that also includes extra specialization. Particular classes of Tree , such as Oak or Ash , have all the charac-
teristics of the most general type, Tree ; otherwise, they could not be considered to be such. However, each
Search WWH ::

Custom Search