OOPs principles are as follows:
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.
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 is acting as a public interface here.
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.
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.
|Object and Class in Java.|
|Abstraction in java.|
|Encapsulation in java.|
|Polymorphism in java.|