By: Jatin Chawla
Object Oriented Programming is an approach to organize and develop the program, which attempts to eliminate some of the drawbacks of Conventional Programming methods . All the languages are not suitable with OOP concept. Language that support OOP concept / features include C++, ADA, Object Pascal, Java. C++ is basically a procedural language that follow only some features of OOP. Java is a core Object Oriented Programming Language.
There are following features of OOP followed by Java:
Objects and Classes
Object is similar like an entity such as table, chair, pen etc. Every entity has some its behavior and attributes.
A person is also an object that has some behaviours (methods) such as To walk, To breathe, To listen, To talk, To see etc. that are accomplished by some of its attributes i.e. Nose, Eye, Ear, Legs etc.
They may represent any living or non living entity like a person, a place, a bank account, a record of student etc. Program objects should be chosen in a manner they match closely with real word objects.
When a program is executed, the objects interact by sending message from one to another. To create an object in Java, we use following syntax.
class <Class name>
{
………………… //Class body
………………… //Class body
………………… //Class body
}
e.g. Student s;
Class is a building block of Java. It is a logical way to group together Fields that hold values and associated methods that operate on these fields into a single unit. To create a class in Java, we use following syntax.
<Class name> <Object name>;
example
class Student
{
int roll;
String name;
public void get()
{
roll=20;
name="Jatin";
}
}
Data Abstraction and Encapsulation
The process of linking / binding data and associated code / procedures to make them a compound unit, is called data encapsulation. When data and code is associated with one another, they create objects. These objects support the Encapsulation mechanism. In this process, the data OR code may be public / private / protected / friendly etc. Private code is only accessible by the particular part of that object, whereas public code is accessible by any other object.
Abstraction is a very classic feature that defines only fundamental / vital information without involving the Source code information or elaboration. When we use the social networking sites such as facebook, orkut etc. OR any other sites; we only complete the particular task. We does not check the source code of that webpage. Let we talk about our daily life, when we have softdrink; we only enjoy the taste of that, we does not try to know which type of chemicals are used for preparing this.
Inheritance
Inheritance means Heredity i.e. Transfer some qualities and attributes of parents to their children. Inheritance is a process to derive new classes from already existing classes. Existing class is called Super / Base / Parent class and new class is known as Sub / Derived / child class. This process defines the characteristics hold by Super class, inherited by the sub class. The basic way to adopt this concept is that work again with the same qualities / standards.
e.g. If we talk about persons, every person has a name; If we talk about students, every student is a person and it acquire the attributes of person class.
There are three type of inheritance:
- 1. Simple Inheritance

- 2. Multilevel Inheritance

- 3. Hierarchical Inheritance

Polymorphism
Polymorphism is very striking concept. In formal way Polymorphism means having or passing through many stages of development. In technical language, Poly means many and morphism means the process to change e.g. when we change one image to another image using computer animation tools, it means we are changing the form of one image to further (Basic image to Advanced).
e.g. In our family and in our social network, usually we are known as different-different name.
We can use this concept to create and define multiple level of interface.
If we talk about Method Overloading, There is a group of methods having same name but differ in argument / parameter list. Method overloading does not depend on return type of method. This is the type of Multiple Polymorphism.
Method overriding is the type of Single Polymorphism.
Dynamic Binding
In our daily life, Binding means something that link together to any other thing. In java, Binding refers to the linking of procedures call to the code to be executed in response to the call. In other words, Binding is a process that links / connects the objects to procedures / methods / functions in a single unit called class.
Message Communication
This is a process through which objects can interact / communicate with one another. People pass / send messages to one another through many means such as Mobile, Letter etc. In the similar way Object communicate with one another by sending and receiving information through requesting their procedures / methods.
Figure: Passing message



Link to Us