In this Post, we will discuss the OOPS concepts along with their role in developing the java programs.OOPS stands for Object Oriented Programming. In OOPS programming model, programs are developed around the data rather than actions and logics. In OOPS, every real life object has behavior and properties,which is achieved through class and object.
OOPS provides a better flexibility and compatibility for developing large applications.
There are four main pillars of an Object Oriented programming Language:
Inheritance :
It is a process of creating new class and use the behavior of the existing class by extending them for reuse the existing code and adding the additional features as you need. That means a new class will acquire all the features of the existing classes is called inheritance.
Let us understand this concept with example:
class One
{
private int a;
private int b;
public void method1( )
{}
}
class Two extends One
{
private int c;
public void method2()
{}
}
In the above example extends indicate that you are making a new class that derives from an existing class. The existing class is called super class and the new class is called sub class.
Advantages:
1) The process of creating new classes is very easy
2) re-usability of the code
For more details on Inheritance: Java inheritance with example
Encapsulation :
Encapsulation is the ability to bundle the property and method of the object and also operate them. It is the mechanism of combining the information and providing the abstraction as well. When you use objects that some else implemented and invoke methods on them,you don't need to know what goes internally this is nothing but encapsulation.
For more details: Encapsulation in java with examples
Polymorphism:
Polymorphism is the way that provide the different functionality by the functions having the same name based on the signatures of the methods. There are two type of polymorphism first is run-time polymorphism and second is compile-time polymorphism.
For more details : polymorphism in java with examples
Abstraction:
Abstraction is the process of hiding implementation details and showing only functionality to the user. In a class may be a lot of data, but user does not need the entire data. The user requires only some part of the available data. In this case we hide the unnecessary data from the user and expose only that data that is of interest to the user. This is nothing but abstraction.
The advantage of abstraction is that every user will get his own view of the data according to his requirements and will not get confused with unnecessary data.
Fore more details: abstraction in java with examples
For more details: Encapsulation in java with examples
Polymorphism:
Polymorphism is the way that provide the different functionality by the functions having the same name based on the signatures of the methods. There are two type of polymorphism first is run-time polymorphism and second is compile-time polymorphism.
For more details : polymorphism in java with examples
Abstraction:
Abstraction is the process of hiding implementation details and showing only functionality to the user. In a class may be a lot of data, but user does not need the entire data. The user requires only some part of the available data. In this case we hide the unnecessary data from the user and expose only that data that is of interest to the user. This is nothing but abstraction.
The advantage of abstraction is that every user will get his own view of the data according to his requirements and will not get confused with unnecessary data.
Fore more details: abstraction in java with examples
For more details : polymorphism in java with examples
Abstraction:
Abstraction is the process of hiding implementation details and showing only functionality to the user. In a class may be a lot of data, but user does not need the entire data. The user requires only some part of the available data. In this case we hide the unnecessary data from the user and expose only that data that is of interest to the user. This is nothing but abstraction.
The advantage of abstraction is that every user will get his own view of the data according to his requirements and will not get confused with unnecessary data.
Fore more details: abstraction in java with examples
I hope you people enjoy this post and share this to your friends and in social websites,also write comments on this concept.Keep follow me for latest updates
No comments:
Post a Comment