: to implement real-word entities, for example, object, classes, abstraction, inheritance, polymorphism, etc.
Object means a real-world entity, and OOP is a methodology or paradigm to design a program using classes and object.
-
any entity that has state and behavior is know as an object
-
can be defined as an instance of a class
-
can communicate without knowing the details of each other's data or code
-> the only necessary thing is the type of message accepted and the type of response returned by the objects
collections of objectis called class- does not consume any space
- provides code
re-usability - used to achieve runtime
polymorphism
-
If one task is performed in different ways, it is known as polymorphism
-
In Java, we use
method overloadingandmethod overridingto achieve polymorphism
Hiding internal detailsandshowing functionalityis know as abstraction- In Java, we use
abstract classand interlace to achieve abstraction
- Binding (or wrapping) code and data together into a single unit are known as encapsulation
- A
Java classis the example of encapsulation Java beanis the fully encapsulated class since all the data members are private here