In the olden days, not only did we have to walk a mile in the chilling winds of a snowstorm to get to school (hey our grandparents had it rougher; they had to do it to get to day care), we also had to make programs without buttons and scrollbars. Now, of course, we have object-oriented programming. This article will introduce you to the most important concepts as they relate to Java.
There are five basic concepts employed in object-oriented programming (hereinafter referred to as OOP). I will cover the basics of each category and how they relate to the programming process.
To keep it simple, an object is an abstract representation simulating everyday objects around you. If you are using Windows, or any application designed during the mid-nineties and beyond, you have seen them thousands of times. They come in a variety of forms: buttons, pull-down menus, scrollbars, that little garbage can that you try your best to fill but never seem able to. Those are all objects, and despite their digital appearance, they like to be treated as such.
What do I mean by that? No, you can't physically press a button on a computer screen, let alone set a digital trash can out by the curb to be manhandled by your sanitation engineers. Objects have two characteristics about them. These are state and behavior. I'll discuss both of these in further detail.
Florida, Virgina, Idaho...these are all examples of states. Unfortunately, they are the wrong example. State, at least in programming terms, describes the object. If I were to say my girlfriend was an object (which I wouldn't unless I really wanted her to become my EX-girlfriend), I could then describe her state in the following fashion: red-haired, Caucasian, her name. Maybe she is annoyed at me for not taking out the garbage. That could be a state also. In the same way, objects in programs have similar states. Any given object can have a different number of states. The television, for instance, has an on state and an off state. A person, on the other hand, can have innumerable states. They can be awake, asleep, hungry, tired, bored, and so forth.
The other characteristic an object possesses is a behavior. You could view this as what the object does once you change its state. If my dog was an object, there would be a variety of behaviors it could exhibit. It could eat, sleep, sit, stand, roll over, play dead, and stay (which is pretty unlikely when the mailman is at the door). And just as objects can have multiple states, so too can they have a plethora of behaviors, or even just one.