go to previous page   go to home page   go to next page        


Yes. In order for a plan to be followed, it has to somehow exist.


Classes are mostly used to create objects, just as a cookie cutter is mostly used to create cookies. But a class has an existence, just as a cookie cutter has an existence. A class and its objects are different types of things, just as a cookie cutter and its cookies are different types of things.

A cookie cutter has characteristics that are not shared with cookies. For example, a cookie cutter is made of steel and has sharp edges. After a cookie cutter has been used for a while, there will be many cookies (soft, rounded, doughy things) but only one thing made of steel with sharp edges.

In the Java language, a characteristic of a class definition that is not shared by its objects is called static. There is only one class definition for a given class, so when a program is running, if something is static then there is only one of it.

You can think of the word static as meaning "no matter how many objects are made, there will be only one of these."


Recall the three properties of objects: identity, state, and behavior. Do you expect that a class definition will have its own state and behavior?