Java Object Oriented Language
Java is built on the concept of OOPs(Object Oriented Programming).OOPs is based
on real world objects around us,Objects that can hold entities such as
behaviors and information.We know every real life object has some properties and
OOPs just implements them in the programs.
Pillars Of OOPs
The concept Of OOPs is broadly divided into four main topics.They are
commonly referred as Pillars of OOPs.These 4 pillars are:
- Compile-time Polymorphism
- Run-time Polymorphism
Encapsulation In Java
Encapsulation is the technique of making the fields in a class private and
providing access to the fields via public methods.Class or the methods of a
class can be resisted to change by using Access Specifiers.The various
access specifiers are public,default,private and protected.
If a field is declared private, it cannot be accessed by anyone outside the
class, thereby hiding the fields within the class.This is the reason why
encapsulation is also referred to as data hiding.
Polymorphism In Java
Polymorphism in simple language is referred as one name many forms.It is the
ability of the object to take many forms. The most common use of polymorphism
in OOP occurs when a parent class reference is used to refer to a child class object.
Polymorphism occurs in two ways-:
We will study about polymorphism in detail in the coming tutorial.
Inheritance In Java
Inheritance can be defined as the process where one object acquires
the properties of another.The main purpose of this concept is re-usability.
It is implemented in java by using Extends and Implements keywords.
Abstraction In Java
Abstraction refers to the ability to make a class abstract in OOPs.In simple
words hiding the complexity and showing the functionality.An abstract class
is the in which objects cannot be created.All other functionality of
the class still exists and its fields, methods and
constructors are accessed in the same manner.