Object Oriented Programming Fundamentals

Object Oriented Programming is a methodology or paradigm to design a program using classes and objects.

Following are the concepts of object-oriented programming :

1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation

Object
Any entity that has state and behaviour is known as object. For example : chair, pen, table, keyboard, etc. It can be physical and logical.

Class
Collection of objects is called class. It is a logical entity.

Inheritance
When one object acquires all the properties and behaviours of parent object i.e. is known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

Polymorphism
When one task is performed by different ways i.e known as polymorphism.
In java, we use method overriding and method overloading to achieve polymorphism.

Abstraction
Hiding internal details and showing functionality is known as abstraction. For example: phone call, we dont know the internal processing.

In java, we use abstract class and interface to achieve abstraction.

Encapsulation
Binding code and data together into a single unit is known as encapsulation.

Java class is an example of encapsulation. Java bean is the fully encapsulated class because all data members are private here.

Comments

Popular posts from this blog

Collection Framework - HashSet And LinkedHashSet class

Collection Framework - Cursors in Java

Hashed data structures