: 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 object
is 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 overloading
andmethod overriding
to achieve polymorphism
Hiding internal details
andshowing functionality
is know as abstraction- In Java, we use
abstract class
and interlace to achieve abstraction
- Binding (or wrapping) code and data together into a single unit are known as encapsulation
- A
Java class
is the example of encapsulation Java bean
is the fully encapsulated class since all the data members are private here