OOP in Java is a programming paradigm that uses classes and objects to design software. Where classes are the blueprint and the objects are the real-world entities. OOP full form is Object-Oriented Programming.
For example, we need to work with cars. So first we need to create a blueprint or design for the cars and from the blueprint we can create more cars like Audi, BMW, Toyota, etc. OOP focuses on creating reusable code and organizing the program into classes and objects.
OOP is based on four main principles
1. Encapsulation
2. Abstraction
3. Polymorphism
4. Inheritance
1. Encapsulation:
Encapsulation combines data and methods. IT restricts direct access to some of the objects components, which protects the data from outside interference and misuse.
2. Abstraction:
Abstraction is the concept of hiding the comples implementation details and showing only the essential features of the object. It is achieved using abstract classes and interfaces.
3. Polymorphism:
Polymorphism is the process of doing the same thing in different ways. In Java, Polymorphism can achieve using method overloading and method overriding
4. Inheritance:
Inheritance is the process when a class inherits properties and behavior from another class
We will learn more about OOP in Java in the next chapters.