Various Features of The Object Oriented Programming Language

Explain the various features of the Object Oriented Programming Language.

The object oriented principles are-

1. Encapsulation
2. Inheritance
3. Polymorphism
4. Dynamic Binding

1. Encapsulation

Encapsulation means the detailed implementation of a component which can be hidden from rest of the system. Encapsulation means binding of data and method together in a entity called class. The data inside that class is accessible by the function in the same class. It is normally not accessible from the outside of the component.

2. Inheritance

Inheritance is a property by which the new classes are created using the old classes. In other words the new classes can be developed using some of the properties of old classes. 

The old classes are referred as base classes and the new classes are referred as derived classes. That means the derived classes inherit the properties of base class.

As shown below example the shape is a base class from which the circle, line, and rectangle are the derived classes. These classes inherit the functionality draw() and resize(). Similarly, the rectangle is a base class for the derived class square.

3. Polymorphism

Polymorphism is the ability to take more than one form and refers to an operation exhibiting different behavior instances. Object oriented programs use polymorphism to carry out the same operation in a manner customized to the object. Without polymorphism, you should have to create separate module names for a each method.

For example the method clean is used to clean a Dish object, one that cleans a car object, and one that cleans a vegetable object.
With polymorphism, you create a single “clean” method and apply it for different objects.

4. Dynamic Binding

Binding refers to the linking of a procedure call to the code to be executed in response to the call. In static binding which function is to be called for a particular object is determined at the compile time. Selection of particular function for call is 
based on the type of formal parameters.

Dynamic binding is a kind of binding in which it is decided at run time which function should be associated with a particular class or a object. In dynamic binding a function is declared virtual in order to instruct compiler that the code being generated for it is of type dynamic binding type. In dynamic binding the code associated with a given procedure call is not known until the time of the call at run-time.

Java Tips

See also

Do you have a Java Problem?
Ask It in The Java Forum

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.