Object oriented programming concept in java

1.Abstraction
2.Encapsulation
3.Inheritance
4.Polymorphism

1.Abstraction

Abstraction is hiding implementing complexity from user and providing only essential features.






class MountainBike extends Bicycle {

    // new fields and methods defining 
    // a mountain bike would go here

}



2.Encapsulation

  The process of binding data and methods together in a same class is called encapsulation.



advantages:
 Data security and maintainability


3.Inheritance

   Inheritance in which a class acquires same or all features of some other class

advantages:
1.code reusability
2.maintainability
3.productivity
4.cost effectiveness

A diagram of classes in a hierarchy.

4.Polymorphism 

A single entity takes multiple forms is called Polymorphism

 

Comments