|
Is it possible for a program to have several objects all of the same class? A good answer might be:Yes. A class is a description of potential objects and can be used many times to make many objects of the same type. The objects do not have to have the same data inside of them, just the same over all plan. | |
Using a Class to Make Many ObjectsA class is like a cookie cutter that can be used many times to make many cookies. Cookies are objects and each one has its own individuality because each one is made out of a different section of dough. Different cookies may have different characteristics, even though they were all made with the same cookie cutter.
A big cookie jar might require many cookies made with many different cookie cutters. A big cookie (such as a gingerbread house) might be built out of many smaller cookies. | |
QUESTION 11:(Thought question.) Cookies in the real world are objects, of course. But real world cookie cutters are objects too. Do you think that a Java class has an object-like nature, just as does a cookie cutter? Click Here after you have answered the question |