Home arrow Java & J2EE arrow Java and Object-Oriented Programming

Java and Object-Oriented Programming

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.

  1. Java and Object-Oriented Programming
  2. How State and Behavior Affect One Another
  3. Class, Inheritance and Interface
  4. All About Variables
By: James Payne
Rating: starstarstarstarstar / 15
September 19, 2007

print this article



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.

>>> More Java & J2EE Articles          >>> More By James Payne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates


Dev Shed Tutorial Topics: