Introduction To Object Oriented Programming

Java is a programming language for developing enterprise applications.
This language is evolved from Oak. It was developed by Sun Microsystems.
 Object-oriented programming  is a programming  uses "objects" and their interactions to design applications and computer programs.

Any OOP must support the following features.
1.Abstraction
2.Encapsulation
3.Inheritance 
4.Polymorphism   

Before going through all these, first learn
 What is  a class?
What is an Object?
Class
class is the blue print from which an individual objects.
or simply we can say
A class is a collection of related data and related methods.

Object
Instance of the class is known as Object.

i.e when we create an object memory will be assigned.
for example an engineer will give a plan to construct a building. With that plan, a constructor will build multiple buildings.

here plan is the class and its not existed really.

building is an object and it exists really.
Lets see the OOPS features:

Abstraction:  Showing the essential and hiding the non-Essential is known as Abstraction.

 

Encapsulation: The Wrapping up of data and functions into a single unit is known as Encapsulation.

     Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessed via the interface of the object.

 

Inheritance: is the Process by which the Obj of one class acquires the properties of Obj’s another Class.

 A reference variable of a Super Class  can be assign to any Sub class derived from the Super class.

         Inheritance is the method of creating the new class based on already existing class , the new class derived is called Sub class which has all the features of existing class and its own, i.e sub class.

Advantages: Reusability of code , accessibility of variables and methods of the Base class by the Derived class.

 

Polymorphism: The ability to take more that one form, it supports Method Overloading &  Method Overriding.


Comments

Popular posts from this blog

What is Android ?