How OOPS concept is achieved in Java
The following stages are the concept of oops achieved in Java,
- Object
- Class
- Abstraction
- Encaptulation
- Inheritance
- Polymorphism
Class:
- A class is a set of objects which have common properties. It is a template or blueprint from which objects are created. In other term, a class is the group of objects showing same behavior will come under the same group.
Object:
- The Object is the real-time entity having some state and behavior. In Java, Object is an example of the class having the instance variables like the state of the object and the methods as the behaviour of the object. The object of a class can be formed by using the new keyword in Java Programming language.
Abstraction:
- It can be defined as the separation of unnecessary details or explanation from system requirements so as to reduce the complexities of understanding requirements.
Encapsulation:
- It is a mechanism that puts the data and function together. It is the result of hiding implementation details of an object from its user.The object hides its data to de accessed by only those functions which are packed in the class of that object.
Inheritance:
- It is the relationship between two classes of object such that one of the classes ,the child takes all the relevant features of other class the parent. Inheritance bring about reusability.
![Class and Object](https://cdn.wikitechy.com/interview-questions/java/multiple-inheritance.gif)
Polymorphism:
- Polymorphism means having many forms that in a single entity can takes more than one form. Polymorphism is implemented through operator overloading and function overloading.
![Class and Object](https://cdn.wikitechy.com/interview-questions/java/polymorphism-in-java.jpg)