OOPS, which is nothing but set of rule and regulation or formula or syntax. When we use it our program will optimize or perfect.

oops


  1. Class &  Object
  2. Inheritance
  3. Ploymorphism
  4. Data Abstraction 
  5. Encapsulation
  6. Interface 
  7. Constructor

Class & Object

  • class is defined as a collection of object or blueprint
  • Object is an entity that has state and behavior

Inheritance

  • with the object of child class, you can access the parent variable and function

 Types

  1. Single inheritance
  2. Multilevel inheritance
  3. Hierarchical inheritance
  4. Hybrid inheritance
USES
  • Reusing code 
  • Memory management 
  • Multiple Inheritance does not support in java 

Polymorphism

It is ability of data to be processed in more than one form
  1. Method overloading – ( Compile time polymorphism)——>function have same name but different argument  
  2. Method overriding – ( Runtime polymorphism)——>return type, no. of argument in both parent and child classes , while exacting only child class function will run 

Data abstraction

It will show only essential information and hide “unnecessary” information
for example: ATM machine, it will show only essential data and unessential data 
  • It is restricted, class that cannot be used to create object
  • It contain abstract method, which contains only declaration, implementation, is done in child class
  • It can also have regular method.
  • It can Inherited using extends keyword.
  • It provide data hiding and security
  • For design purpose, a class can be point to objects of its sub-classes, thereby achieving run time

Encapsulation

It is a process of wrapping code and data together into a single unit.

Interface

  • Interface methods do not have a body that body is provided by the implements class on implementation of an interface, you must override all of its Method.
  • Interface methods are by default abstract and public 
  • Interface attributes are by default public, Static and final
  • An interface cannot contain a constructor as it Cannot be used to create object
  • It is used in case of multiple inheritance as Java doesn’t support it
  • An interface reference can point to objects of its implementing classes.

Constructor

  • Constructor is a special type of function inside a class which is used to initialize to object variable
  • Constructor is a special type of subroutine called to create an object
This: is a keyword always point to object
Super: is a keyword, it will point to the immediate 

Leave a Reply

Your email address will not be published.