Skip to content

Latest commit

 

History

History
64 lines (35 loc) · 1.45 KB

02_OOP.md

File metadata and controls

64 lines (35 loc) · 1.45 KB

Java OOPs Concepts


Aim of object-oriented Programming

: to implement real-word entities, for example, object, classes, abstraction, inheritance, polymorphism, etc.



OOPs (Object-Oriented Programming System)

Object means a real-world entity, and OOP is a methodology or paradigm to design a program using classes and object.


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


Class

  • collections of object is called class
  • does not consume any space

Inheritance

  • provides code re-usability
  • used to achieve runtime polymorphism

Polymorphism

  • If one task is performed in different ways, it is known as polymorphism

  • In Java, we use method overloading and method overriding to achieve polymorphism


Abstraction

  • Hiding internal details and showing functionality is know as abstraction
  • In Java, we use abstract class and interlace to achieve abstraction

Encapsulation

  • 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