What is Object Oriented Programming in Java



In the previous articles i explained : Advantages of Object Oriented ProgrammingHow Java different from C and C++History of JavaWhat is Java TechnologyAsp.Net Alert Box, Asp.Net Setup and DeploymentAsp.Net Connection StringAsp.Net Authentication and Authorization and Facebook sidebar like box for website.


In object oriented programming, a complex system is decomposed in accordance to the key abstractions of the problem. Rather than decomposing the problems into steps, we identify objects, which are delivered directly from the vocabulary of the problem domain.

We view the world (problem domain) as a set of autonomous agents that collaborate to perform some higher level behavious. Each object in the solution embodies its own unique behaviour and each one models some object in the real world. The object is simply a tangible entity that exhibits some well defined behaviour. Objects do things we ask them to perform what they do by sending the messages. OOP paradigm helps us to organize the inherent complexities of sofware systems.


It is a method of implementation in which programs are organized as co-operative collection of objects, each of which represents an instance of some class and whose classes all members of a hierarchy of classes united in inheritance relationships.

oop object oriented programming.

Objects of the pogram interact by sending messages to each other.

Object oriented programming derives from the way we think about day-to-day objects such as telephones, cars etc. Programmers just like to use words like encapsulation and inheritance to confuse the average person when talking about object oriented programming. The concept is actually quite simple since we can relate physical objects to understand how the process actually works.

There are a few principle concepts that form the foundation of object-oriented programming:

Objects and Classes

Object is a physical entity which represents a person, vehicle or a conceptual entity (thing in existence) like bank account, company etc.

A set of variable and functions used to describe an object is a "class".


Abstraction - the act or process of leaving out of consideration one or more qualities of a complex object so as to attend to others. Solving a problem with objects requires you to build the objects tailored to your solution. We choose to ignore its inessential details, dealing instead with the generalized and idealized model of the object.


The ability to provide users with a well defined interface to a set of fucntions in a way, which hides their internal workings. In object oriented programming, the technique of keeping together data structures and the methods (procedures) which act on them. The easiest way to think of encapsulation is to reference  phones. There are many different types of phones, which consumers can purchase today. All of the phones used today will communicate with each other through a standard interface. A phone made by GE can be used to call a phone made by Panasonic for example. Although their internal implementation may be different their public interface is the same. This is the idea of encapsulation.

Information Hiding

It is a process of hiding all the secrets of an object that do not contribute to its essential characteristics. Typically, the structure of an object is hidden as well as the implementation of the methods.


Inheritance in object oriented programming means that a class of objects can inherit properties from another class of objects. When inheritance occurs, one class is then referred to as the 'parent class' or 'superclass' or 'base 'class'. In turn, these server as a pattern for a 'derived class' or 'sub class'.

Inheritance is an important concept since it allows reuse of class definition without requiring major code changes. Inheritance can mean just reusing code, or can mean that you have used a whole class of object with all its variables and functions. Why not reuse an existing class that has behaviours similar to whay you need in a new program?

For example, the bike is a part of the class two wheelers, which is again a part of class vehicle as shown i the following fig.

object oriented programming oop


It is a key concept in object oriented programming. Poly means may and morph means chage (or 'form'). Many changes of form or changes of form by many.

Polymorphism is simply a name given to an action that is performed by similar objects. Polymorphism allows a common data gathering message to be sent to each class and allows each subclass object to respond to a message format in an appropriate manner to its own properties. Polymorphism encourages something we call 'extendibility'. In other words, an object or a class can have it's uses extended.

Message Passing

In an object based world the only way for anything to happen is by objects communicating with each other and acting on the results. This communication is called message passing and involves one object sending a message to another and (possibly) receiving a result.

Give your Valuable Comments.
comments powered by Disqus
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
More Articles