OOPs(Object-Oriented Programming System) Concepts in Java

1. Object

2. Class

3. Inheritance

4. Polymorphism

5. Abstraction

6. Encapsulation

OOPS Concepts in Java | Java OOPS Concepts with Example

Class:

A class is a blueprint that describes the behaviors/states from which individual objects are created.

Object:

An object is an instance of a class.

Encapsulation

is the method of creating the fields in a class personal and supplying get admission to the fields through public techniques. If an area is asserted private, it can not be accessed by every person out of doors the magnificence, thereby hiding the fields inside the magnificence. for this reason, encapsulation is likewise referred to as records hiding.

Encapsulation may be described as a protecting barrier that forestalls the code and statistics being randomly accessed through other code described outside the magnificence. get entry to to the information and code is tightly controlled by way of an interface.

the principle advantage of encapsulation is the potential to regulate our implemented code without breaking the code of others who use our code. With this feature, Encapsulation gives maintainability, flexibility, and extensibility to our code.

Inheritance

Inheritance can be defined as the manner wherein one object acquires the properties of every other. With the usage of inheritance, the facts are made workable in a hierarchical order.

whilst we speak about inheritance, the most normally used key-word might be extended. This phrase might determine whether or not one item IS-A kind of another. through using this key-word we will make one item acquire the properties of some other item.

Polymorphism

Polymorphism is the potential of an item to take on much bureaucracy. The most common use of polymorphism in OOP takes place whilst a discern elegance reference is used to refer to an infant magnificence object.

Any Java item that may skip a couple of IS-A take a look at is taken into consideration to be polymorphic. In Java, all Java objects are polymorphic considering any item will bypass the IS-A test for his or her personal kind and for the class object.

Share