OOP's Concept in Java
OOP's Concept in Java
Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects.
- Object
- Class
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Object
Object is the physical as well as logical entity where as class is the only logical entity. Object in Java
Class
Class: Class is a blue print which is containing only list of variables and method and no memory is allocated for them. A class is a group of objects that has common properties. Class in Java
Encapsulation
Encapsulation is a process of wrapping of data and methods in a single unit is called encapsulation. Encapsulation is achieved in C++ language by class concept. The main advantage of using of encapsulation is to secure the data from other methods, when we make a data private then these data only use within the class, but these data not accessible outside the class. Encapsulation in Java
Abstraction
Abstraction is the concept of exposing only the required essential characteristics and behavior with respect to a context. Abstraction in Java
Hiding of data is known as data abstraction. In object oriented programming language this is implemented automatically while writing the code in the form of class and object.
Inheritance
The process of obtaining the data members and methods from one class to another class is known as inheritance. It is one of the fundamental features of object-oriented programming. Inheritance in Java
Polymorphism
The process of representing one Form in multiple forms is known as Polymorphism. Here one form represent original form or original method always resides in base class and multiple forms represents overridden method which resides in derived classes. Polymorphism in Java
Features of OOP's Language
- Better memory management
- Suitable for large projects
- Fairly efficient languages
- It implements real life scenario
- It is easy to maintain and modify existing code
- Implementation details are hidden from other modules
Note: All these concept I will discuss in detail later.
What are the 4 Pillars of OOPs ?
Abstraction, Inheritance, Encapsulation and Polymorphism are the four pillars of OOPs.