Java is an objected oriented programming language. This means that programs created in Java are designed to model real world objects in terms of their properties, behaviour and how the relate to each other.

We can think of an object as a fancy variable; it stores data, but you can interact with the object by “making requests” to it asking it to perform operations on itself. In OOP you take whatever real world component in the problem you are trying to solve (house, dog, computer, etc.) and represent it as an object in your program.

All objects have two properties:

  • State: An object contains one or more items of information.
  • Behaviour: An object has behaviour: it responds to operations that are performed on it. Some of these operations may change the state of the object.

Example: Car
The state of a car can include attributes such as fuel, oil, tire pressure etc…
The behaviour of a car can contain operations such as starting the engine or driving a certain distance which would involve changing the odometer reading.

In this way nearly evey real-world object can be modeled within a program although we often need to simplify our program model by ignoring details that are not relevant.

We now need to look at how to create classes in Java that model these real world objects so that we can store and manipulate information about them.

Leave a Reply

Your email address will not be published. Required fields are marked *