reading-notes

Inheritance and Interfaces

Interfaces:

benefits of Interfaces:
  1. It is used to achieve abstraction.
  2. By interface, we can support the functionality of multiple inheritance.
  3. It can be used to achieve loose coupling.
Syntax:
interface <interface_name>{  
      
    // declare constant fields  
    // declare methods that abstract   
    // by default.  
}  

Inheritance:

benefits of inheritance:
  1. Method Overriding.
  2. Code Reusability.
syntax :
class Subclass-name extends Superclass-name  
{  
   //methods and fields  
}