Programming Tutorials

Polymorphism, Encapsulation and Inheritance in Java

By: aathishankaran in Java Tutorials on 2007-02-20  

When properly applied, polymorphism, Encapsulation and Inheritance combine to produce a programming environment that supports the development of far more robust and scaleable programs than does the process-oriented model.

A well-designed hierarchy of classes is the basic for reusing the code in which you have invested time and effort developing and testing. Encapsulation allows you to migrate your implementations over time without breaking the code that depends on the public interface of your classes. Polymorphism allows you to create clean, sensible, readable and resilient code.

The final attribute, polymorphism, is clearly reflected in the ability of car manufacturers to offer a wide array of options on basically the same vehicle.

For example, you can get an antilock braking system or traditional brakes, power or rack-and-pinion steering, 4,6 or 8 cylinder engines. Either way, you will still press the break pedal to stop, turn the steering wheel to change direction and press the accelerator when you want to move. The same interface can be used to control a number of different implementations.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Java )

Latest Articles (in Java)