Object-Oriented Programming or OOPs is a modern way of programming to use real-life entities. Java uses features of OOPs, that’s why java is known as an Object-Oriented Programming Language. The core concept of OOP is to bind data and function in a single unit with reuse of the code principal.
Features of OOPs.
An object is a real-life entity and it has two characteristics, attribute, and behavior. A real-life entity means everything which exists like your car and mobile. The attribute of your mobile is color, brand name, and size. The behavior of the mobile is making a call and sending SMS. In the programming world, variables declared inside a class are attribute, and the function (method) that is defined inside a class is the behavior of an object.
Class is a blueprint or template which is used to define the attributes and behavior of an object. For example, Car is a class and your own car is an object, Mobile is a class and your personal mobile is an object.
It is a concept of OOP, in which we can create a new class based upon an existing class. The new class can inherit members of the existing class in it. The new class is called sub or derived and the existing class is called base or superclass. For example, Transport is a superclass and Car is a subclass.
In software engineering, abstraction is the hiding of internal details that are required for objects but not for the outside world. For example, the engine of the car is a very important part but not for the outside world.
Encapsulation means wrapping the data(variable) and member function(method) in a single unit. Before the OOPs concept variable and methods were declared separately. For example, the sound system and display unit of the tv is wrapped in a single unit(cabinet).
Polymorphism means many forms, it is a concept in which a function can redefine in different ways. For example, the speed of the car and the airplane can be defined in different ways.