![]() |
Java is one of many languages that is referred to as object oriented. Object oriented programming or OOP is relatively new and quite logical. In the picture to the right are 12 "objects"(not counting the word "objects"). Each object has a name(bat, racquet, Rholl, etc) and each object has properties or qualities associated with it. The bat has a handle, it is long and slender, has an inherited method of being swung, etc. The Rholl object has properties of skin and hair(so far anyway) as well as methods or behaviors like breathing, moving, etc. Also notice that some object share properties with other objects. For example the baseball, the tennis ball, and the golf ball may all belong to the same "superclass" because they have shared properties of being round, being used in a game, etc.
Object oriented thinking is kind of like the classification system of living things you learned in biology. There is a hierarchy of objects. The objects become more and more specific as you move down the hierarchy. Look at the graphic below and to the left.
![]() |
|
Another thing about objects is that you can put them together to make larger objects. For example the Rholl object could be combined with the Mask object, the Fins object, the Snorkel object, and the Innertube object to create a "larger" object, the RhollSwimmer object, with certain properties. This RhollSwimmer object, (right), is an object itself but it has all the properties of the other objects it is built from. For example, it can see underwater because it inherits that behavior from the Mask object. It can swim faster than the basic Rholl object because it inherits the speed of the Flippers object Using this model of object-oriented construction, you can create different Rholl-type objects by combining the basic Rholl object with different objects. You could create a RhollTennisplayer object, a RhollBaseballPlayer object, or a RhollGolfer object. Because object-oriented construction allows to to combine any objects together, you could even create a RhollGolfer object with a swim mask. While it may look funny on the golf course, you could do it and name it the RhollMaskGolfer object. So, object-oriented construction allows you to take existing objects with properties and paste them together to create new objects.
Object-oriented programming even allows you to go a little beyond my analogy of object-oriented construction. You can actually "clone" existing objects and change a property or properties. In Java programming language you create an instance of the existing object. Actually in Java, you hardly ever use the original object. You almost always create a clone or an instance of the original object and give it a new name. For example, now that we have created the RhollSwimmer object, we could create and instance of it and assign it different properties. For example, we could name a new Rholl object(clone him) that has black hair. We might name it: RhollBlackHair = new Rholl(paint his hair black). Now, if we combined this new RhollBlackHair object with the mask, the snorkel, the fins and the intertube objects, we would have a RhollBlackHairSwimmer object.
At some point, we have to leave this little analogy(although I know you love the little rholl guys) and move to Java language. That time is now. If you get confused in the future, remember the little rholl objects and come back to them. They are easy to understand and soothing. But now,
Grading
Schedule
Syntax
JavaDocs
Video
Projects
Links