Wednesday, January 10, 2018

Object Oriented Principles

Object Oriented programming suggests to use the following principles during the design of a software.  

Encapsulation :

Manipulation of an object’s variables by other objects or classes is discouraged to ensure data encapsulation. A class should provide methods through which other objects could access variables.  Java deletes the no longer used objects(Garbage Collection).

Abstraction :

Means, first define a class containing the variables and the behavior (methods) and afterwards you create the real objects which then all behave like the class defined it.
A class is the definition of the behavior and data. A class can not be directly be used.
A object is an instance of this class and is the real object which can be worked with.

Polymorphism :

The ability of object variables to contain objects of different classes.