What are Objects in Java Programming ?


An object has state, behaviour and identity. This means that an object can have internal data (In java member variables which gives it state), methods (to produce behaviour), and each object can be uniquely distinguished from every other object as each object has a unique address in computer memory.

There are five basic characteristics of Java. These characteristics represent a pure approach to object-oriented programming.

  1. Everything is an object

    You can think of an object as a fancy variable which stores data(variables), but you can “make requests” to that object, asking it to perform operations on itself (It has methods). In theory, you can take any conceptual component in the problem you’re trying to solve (dogs, buildings, services, etc.) and represent it as an object in your program.

  2. Object Oriented Program

    A program is a bunch of objects telling each other what to do by sending messages(Calling methods). To make a request of an object, you “send a message” to that object by calling that objects method from another object.

  3. Each Object Has It’s Own Memory

    Each object has its own memory made up of other objects. This means you create a new kind of object by making a package containing existing objects. Thus, you can build complexity into a program while hiding it behind the simplicity of objects.

  4. Every object has a type

    In java Each object is an instance of a class, in which “class” is synonymous with “type”. The most important distinguishing characteristic of a class is “What messages can you send to it?”

  5. All objects of a particular type can receive the same messages

    Because an object of type “circle” is also an object of type “shape,” a circle is guaranteed to accept shape messages. This means you can write code that talks to shapes and automatically handle anything that fits the description of a shape. This is one of great power of OOPS known as polymorphism implemented using inheritance.