SlideShare a Scribd company logo
3
Example.
- A Deer is A Animal
- A Deer is A Vegetarian
- A Deer is A Deer
- The Deer class is considered to be polymorphic. Since it has multiples
inheritance.
Most read
5
Object Oriented Programming - Polymorphism and Interfaces
Most read
13
Interface
 An interface describes a set of methods that can be called on object, but
doesn’t provide concrete implementations for all methods.
 An interface in Java is a blueprint of a class. It has static constants and
abstract methods.
 It is a collection of abstract methods. A class can implements an interface
there by inhering the abstract methods of the interface.
 Once a class implements an interface, all the objects of that class have an
Is – a relationship with the interface type, and all objects of the class are
guaranteed to provide the functionality described by the interface.
Most read
POLYMORPHISM
AND
INTERFACE
HABTAMUW.
Introduction
Poly – means “Many”
Morphs – “Forms”
 Polymorphism: is the ability to treat on objects of any sub-class of a super-
class as if it were an object of the super class.
 There fore, it enables you to write programs that process objects that shares
the same super-class (either directly or indirectly) as if they are all objects of
the super-class.
 Enables you to program in general rather than program in specific.
 In polymorphism objects has the ability of having many forms.
Example.
- A Deer is A Animal
- A Deer is A Vegetarian
- A Deer is A Deer
- The Deer class is considered to be polymorphic. Since it has multiples
inheritance.
◦ Polymorphism is java has two types: these are Method overloading and Method
Overriding.
1. Method Overloading (Compile time polymorphism or static Binding):- a method
overloading means there are several methods present in a class having the same name
but different types/ order/ number of parameters.
- at compile time the JVM knows which method to invoke by checking the method
signatures.
Object Oriented Programming - Polymorphism and Interfaces
2. Method Overriding (Run time polymorphism or Dynamic Binding):- In
inheritance, a child class provides it’s own implementations to the parents
method, there by overriding the implementation of the present.
- Two methods are said to be overridden only if they have the same signature, that
is the same name and the same parameters.
- The parent’s method is called and Overridden Method and the child’s method is
Overriding Method.
Object Oriented Programming - Polymorphism and Interfaces
Advantages of polymorphism
1. Method overloading allows method that perform similar or closely related functions to be
accessed through a common name.
2. Method overloading can be implemented on constructors allowing different ways to
initialize objects of a class. This enables you to define multiple constructors for handling
different types of initialization.
3. Method overriding allows a sub class to use all the general definitions that a super-class
provides and adds specialized definitions through overridden methods.
4. Method overriding works together with inheritance to enable code re-use of existing class
without the need for recompilation.
Abstract class
Abstraction: is a process of hiding the implementation details and showing only
functionality to the user.
 There are some ways to achieve abstraction:
1. Abstract class
2. Interface
1. Abstract class: is a class in which declared with the abstract keyword
 It can have abstract and non-abstract methods.
 It needs to be extended and it’s method implemented.
 It can’t be Instantiated.
Abstract Method: is a method which is declared as abstract and doesn’t have
implementation.
Rules of java abstract class
 It can’t be Instantiated they can be sub-classed.
 It needs to be declared with abstract keyword.
 It can have final methods.
 It can have constructors and static methods.
E.g abstract voii moviio(ioubli iiltaii ioubli iiltai)i
Object Oriented Programming - Polymorphism and Interfaces
Object Oriented Programming - Polymorphism and Interfaces
Interface
 An interface describes a set of methods that can be called on object, but
doesn’t provide concrete implementations for all methods.
 An interface in Java is a blueprint of a class. It has static constants and
abstract methods.
 It is a collection of abstract methods. A class can implements an interface
there by inhering the abstract methods of the interface.
 Once a class implements an interface, all the objects of that class have an
Is – a relationship with the interface type, and all objects of the class are
guaranteed to provide the functionality described by the interface.
Why we use interfaces in java?
The relationship between classes and interfaces?
 Interface can’t be instantiated.
 Interface doesn’t contain any constructor.
 All the methods of interface are abstract.
 Static and final fields can only appear in interface.
 An interface is not extended by a class; it is implemented by a class.
 An interface is implicitly abstract.
 Each method in an interface is also implicit.
 Methods in an interface are implicitly public.
Difference between interface and class
Interface properties
Declaring an interface
Implementing an interface
◦ A class use implements keyword to implement an interface.
Object Oriented Programming - Polymorphism and Interfaces
Extending interfaces
 An interface can extend another interface in the same way that a class can
extend another class using extend keyword, results a child interface inherits
methods of the parent interface.
 A java class can only extend one parent class. However an interface can
extend more than one parent interface.
e.g. public iitirfaci iociii iitiiis sportsi iviits {
}
Extending multiple interfaces
Multiple inheritance in Java by interface
─ If a class implements multiple interfaces, or an interface extends multiple
interfaces, it is known as multiple inheritance.
Object Oriented Programming - Polymorphism and Interfaces
Object Oriented Programming - Polymorphism and Interfaces
Interface inheritance
─ A class implements an interface, but one interface extends another interface.

More Related Content

Similar to Object Oriented Programming - Polymorphism and Interfaces (20)

Interface in java
Interface in javaInterface in java
Interface in java
Kavitha713564
 
INTERFACES. with machine learning and data
INTERFACES. with machine learning and dataINTERFACES. with machine learning and data
INTERFACES. with machine learning and data
dineshkesav07
 
it is the quick gest about the interfaces in java
it is the quick gest about the interfaces in javait is the quick gest about the interfaces in java
it is the quick gest about the interfaces in java
arunkumarg271
 
Basic_Java_10.pdf
Basic_Java_10.pdfBasic_Java_10.pdf
Basic_Java_10.pdf
KumarUtsav24
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritance
Arjun Shanka
 
Inheritance.pptx
Inheritance.pptxInheritance.pptx
Inheritance.pptx
PRIYACHAURASIYA25
 
Exception handling and packages.pdf
Exception handling and packages.pdfException handling and packages.pdf
Exception handling and packages.pdf
Kp Sharma
 
oops with java modules i & ii.ppt
oops with java modules i & ii.pptoops with java modules i & ii.ppt
oops with java modules i & ii.ppt
rani marri
 
Opps
OppsOpps
Opps
Lalit Kale
 
Inheritance
InheritanceInheritance
Inheritance
abhay singh
 
OOPS_Unit2.inheritance and interface objected oriented programming
OOPS_Unit2.inheritance and interface objected oriented programmingOOPS_Unit2.inheritance and interface objected oriented programming
OOPS_Unit2.inheritance and interface objected oriented programming
ssuserf45a65
 
abstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx uploadabstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx upload
dashpayal697
 
Java interface
Java interface Java interface
Java interface
HoneyChintal
 
Java 06
Java 06Java 06
Java 06
Loida Igama
 
Java 6.pptx
Java 6.pptxJava 6.pptx
Java 6.pptx
usmanusman720379
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
ITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptx
kristinatemen
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 ee
homeworkping9
 
20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction
Intro C# Book
 
Binding,interface,abstarct class
Binding,interface,abstarct classBinding,interface,abstarct class
Binding,interface,abstarct class
vishal choudhary
 
Interface in java
Interface in javaInterface in java
Interface in java
Kavitha713564
 
INTERFACES. with machine learning and data
INTERFACES. with machine learning and dataINTERFACES. with machine learning and data
INTERFACES. with machine learning and data
dineshkesav07
 
it is the quick gest about the interfaces in java
it is the quick gest about the interfaces in javait is the quick gest about the interfaces in java
it is the quick gest about the interfaces in java
arunkumarg271
 
Basic_Java_10.pdf
Basic_Java_10.pdfBasic_Java_10.pdf
Basic_Java_10.pdf
KumarUtsav24
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritance
Arjun Shanka
 
Exception handling and packages.pdf
Exception handling and packages.pdfException handling and packages.pdf
Exception handling and packages.pdf
Kp Sharma
 
oops with java modules i & ii.ppt
oops with java modules i & ii.pptoops with java modules i & ii.ppt
oops with java modules i & ii.ppt
rani marri
 
Inheritance
InheritanceInheritance
Inheritance
abhay singh
 
OOPS_Unit2.inheritance and interface objected oriented programming
OOPS_Unit2.inheritance and interface objected oriented programmingOOPS_Unit2.inheritance and interface objected oriented programming
OOPS_Unit2.inheritance and interface objected oriented programming
ssuserf45a65
 
abstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx uploadabstract,final,interface (1).pptx upload
abstract,final,interface (1).pptx upload
dashpayal697
 
Java interface
Java interface Java interface
Java interface
HoneyChintal
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
ITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptxITTutor Advanced Java (1).pptx
ITTutor Advanced Java (1).pptx
kristinatemen
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 ee
homeworkping9
 
20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction
Intro C# Book
 
Binding,interface,abstarct class
Binding,interface,abstarct classBinding,interface,abstarct class
Binding,interface,abstarct class
vishal choudhary
 

Recently uploaded (20)

How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
First Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptxFirst Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptx
KavitaBagewadi2
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptxFundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Blood bank management system project report.pdf
Blood bank management system project report.pdfBlood bank management system project report.pdf
Blood bank management system project report.pdf
Kamal Acharya
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior DevelopersDavid Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
Fundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptxFundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptx
drdebarshi1993
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
PrĂŠsentation_gestion[1] [Autosaved].pptx
PrĂŠsentation_gestion[1] [Autosaved].pptxPrĂŠsentation_gestion[1] [Autosaved].pptx
PrĂŠsentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptxDevelopment of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
The first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptxThe first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptx
Mayank Mathur
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) ProjectMontreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
Journal of Soft Computing in Civil Engineering
 
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.pptCOMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
ravicivil
 
How Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdfHow Binning Affects LED Performance & Consistency.pdf
How Binning Affects LED Performance & Consistency.pdf
Mina Anis
 
First Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptxFirst Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptx
KavitaBagewadi2
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
Fundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptxFundamentals of Digital Design_Class_12th April.pptx
Fundamentals of Digital Design_Class_12th April.pptx
drdebarshi1993
 
Blood bank management system project report.pdf
Blood bank management system project report.pdfBlood bank management system project report.pdf
Blood bank management system project report.pdf
Kamal Acharya
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior DevelopersDavid Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
Fundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptxFundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptx
drdebarshi1993
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
PrĂŠsentation_gestion[1] [Autosaved].pptx
PrĂŠsentation_gestion[1] [Autosaved].pptxPrĂŠsentation_gestion[1] [Autosaved].pptx
PrĂŠsentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptxDevelopment of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
Development of Portable Biomass Briquetting Machine (S, A & D)-1.pptx
aniket862935
 
The first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptxThe first edition of the AIAG-VDA FMEA.pptx
The first edition of the AIAG-VDA FMEA.pptx
Mayank Mathur
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) ProjectMontreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
Journal of Soft Computing in Civil Engineering
 
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.pptCOMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
ravicivil
 
Ad

Object Oriented Programming - Polymorphism and Interfaces

  • 2. Introduction Poly – means “Many” Morphs – “Forms”  Polymorphism: is the ability to treat on objects of any sub-class of a super- class as if it were an object of the super class.  There fore, it enables you to write programs that process objects that shares the same super-class (either directly or indirectly) as if they are all objects of the super-class.  Enables you to program in general rather than program in specific.  In polymorphism objects has the ability of having many forms.
  • 3. Example. - A Deer is A Animal - A Deer is A Vegetarian - A Deer is A Deer - The Deer class is considered to be polymorphic. Since it has multiples inheritance.
  • 4. ◦ Polymorphism is java has two types: these are Method overloading and Method Overriding. 1. Method Overloading (Compile time polymorphism or static Binding):- a method overloading means there are several methods present in a class having the same name but different types/ order/ number of parameters. - at compile time the JVM knows which method to invoke by checking the method signatures.
  • 6. 2. Method Overriding (Run time polymorphism or Dynamic Binding):- In inheritance, a child class provides it’s own implementations to the parents method, there by overriding the implementation of the present. - Two methods are said to be overridden only if they have the same signature, that is the same name and the same parameters. - The parent’s method is called and Overridden Method and the child’s method is Overriding Method.
  • 8. Advantages of polymorphism 1. Method overloading allows method that perform similar or closely related functions to be accessed through a common name. 2. Method overloading can be implemented on constructors allowing different ways to initialize objects of a class. This enables you to define multiple constructors for handling different types of initialization. 3. Method overriding allows a sub class to use all the general definitions that a super-class provides and adds specialized definitions through overridden methods. 4. Method overriding works together with inheritance to enable code re-use of existing class without the need for recompilation.
  • 9. Abstract class Abstraction: is a process of hiding the implementation details and showing only functionality to the user.  There are some ways to achieve abstraction: 1. Abstract class 2. Interface 1. Abstract class: is a class in which declared with the abstract keyword  It can have abstract and non-abstract methods.  It needs to be extended and it’s method implemented.  It can’t be Instantiated. Abstract Method: is a method which is declared as abstract and doesn’t have implementation.
  • 10. Rules of java abstract class  It can’t be Instantiated they can be sub-classed.  It needs to be declared with abstract keyword.  It can have final methods.  It can have constructors and static methods. E.g abstract voii moviio(ioubli iiltaii ioubli iiltai)i
  • 13. Interface  An interface describes a set of methods that can be called on object, but doesn’t provide concrete implementations for all methods.  An interface in Java is a blueprint of a class. It has static constants and abstract methods.  It is a collection of abstract methods. A class can implements an interface there by inhering the abstract methods of the interface.  Once a class implements an interface, all the objects of that class have an Is – a relationship with the interface type, and all objects of the class are guaranteed to provide the functionality described by the interface.
  • 14. Why we use interfaces in java?
  • 15. The relationship between classes and interfaces?
  • 16.  Interface can’t be instantiated.  Interface doesn’t contain any constructor.  All the methods of interface are abstract.  Static and final fields can only appear in interface.  An interface is not extended by a class; it is implemented by a class.  An interface is implicitly abstract.  Each method in an interface is also implicit.  Methods in an interface are implicitly public. Difference between interface and class Interface properties
  • 17. Declaring an interface Implementing an interface ◦ A class use implements keyword to implement an interface.
  • 19. Extending interfaces  An interface can extend another interface in the same way that a class can extend another class using extend keyword, results a child interface inherits methods of the parent interface.  A java class can only extend one parent class. However an interface can extend more than one parent interface. e.g. public iitirfaci iociii iitiiis sportsi iviits { } Extending multiple interfaces
  • 20. Multiple inheritance in Java by interface ─ If a class implements multiple interfaces, or an interface extends multiple interfaces, it is known as multiple inheritance.
  • 23. Interface inheritance ─ A class implements an interface, but one interface extends another interface.