OOPs concepts in java

OOPs principles are as follows:

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

1. Abstraction:

Abstraction is a way of hiding complexity. Let us take the example of a car. We know that if accelerator pressed, speed will increase but don’t know the internal process how speed will be increased.

2. Encapsulation:

Encapsulation is a process of wrapping code and data into a single unit. Let us take an example of a HR in a company. We communicate through HR not directly with the departments. HR actsing as a public interface here.

3. Polymorphism:

Polymorphism means more than one forms. In java polymorphism is a way in which something behaves differently based on its call. Water can be of in any form solid, liquid or gas.

4. Inheritance:

Inheritance is the way of re-usability of code. Let us take the example of parent and child. A child inherits the properties of its parent.
Next Topic: Abstraction in java.
Previous Topic: Object and Class in Java.


Please Share