SlideShare a Scribd company logo
1 of 14
Session-3A
● This module introduces patcipants to the java
interface.
● Describes inheritence of interfaces
● creation of objects to interfaces.
● Abstract classes
Module Overview
2
Interface
An interface is an abstract data type that defines a list of abstract public
methods that any class implementing the interface must provide. An
interface can also include a list of constant variables and default
methods.
•Interface is defined with the interface keyword.
• Interfaces cannot be instantiated directly.
• An interface is not required to have any methods and may not be
marked as final.
•All nondefault methods in an interface are assumed to have the
modifiers abstract and public in their definition.
• All top-level interfaces are assumed to have public or default
access, and they must include the abstract modifier in their
definition.
•Marking an interface as private, protected, or final will trigger a
compiler error, since this is incompatible with these assumptions.
Interface
//abstract method means unimplementation or no
implementation
public interface Person {
public final static String country="India";
public abstract boolean
isHospitalised();//unimplemented methods
}
Interface Variables
Interface variables rules:
1. Interface variables are assumed to be public, static, and
final. Therefore, marking a variable as private or
protected will trigger a compiler error, as will marking
any variable as abstract.
2. The value of an interface variable must be set when it is
declared since it is marked as final.
Interface Inheritence
Inheritance rules when extending an interface:
1. An interface that extends another interface, as well as an
abstract class that implements an interface, inherits all of the
abstract methods as its own abstract methods.
2. The first concrete class that implements an interface, or extends
an abstract class that implements an interface, must provide an
implementation for all of the inherited abstract methods.
Inheritence example
//abstract method means unimplementation or no
implementation
public interface Person extends
PhysicallyChallenged,Resident{
public final static String country="India";
public abstract boolean
isHospitalised();//unimplemented methods
}
Default Method(java 8)
A default method is a method defi ned within an
interface with the default keyword in which a method
body is provided. Contrast default methods with
“regular” methods in an interface, which are assumed to
be abstract and may not have a method body.
A default method within an interface defi nes an abstract
method with a default implementation. In this manner,
classes have the option to override the default method if
they need to, but they are not required to do so. If the
class doesn’t override the method, the default
implementation will be used.
Default Method Example
public interface IsAdmitted{
boolean hasInsurance();
public default double getBill() {
return 1000.0;
}
}
Note:- methods of an interface are always public.
Default method rules
1. A default method may only be declared within an
interface and not within a class or abstract class.
2. A default method must be marked with the default
keyword. If a method is marked as default, it must
provide a method body.
3. A default method is not assumed to be static, final, or
abstract, as it may be used or overridden by a class that
implements the interface.
4. Like all methods in an interface, a default method is
assumed to be public and will not compile if marked as
private or protected.
Static methods in Interface(java 8)
Static methods are defi ned explicitly with the static
keyword.
There is one distinction between a static method in a class
and an interface.
A static method defi ned in an interface is not inherited
in any classes that implement the interface.
Here are the static interface method rules you need to be
familiar with:
1. Like all methods in an interface, a static method is
assumed to be public and will not compile if marked as
private or protected.
2. 2. To reference the static method, a reference to the
name of the interface must be used.
Static Method Example
public interface Discharge{
static int no_Of_Days_Admit() {
return 10;
}
}
Polymorphism
Polymorphism is a oops feature in which the property of
an object takes on many different forms.
No of ways polymorphism achieved:
Java object may be accessed using a reference with the
same type as the object .
Reference that is a superclass of the object,
Reference that defi nes an interface the object
implements, either directly or through a superclass.
Explicit cast is not required if the object is being
reassigned to a super type or interface of the object
Thank you.

More Related Content

Similar to 03_A-OOPs_Interfaces.ppt

this keyword in Java.pptx
this keyword in Java.pptxthis keyword in Java.pptx
this keyword in Java.pptxParvizMirzayev2
 
Corejavainterviewquestions.doc
Corejavainterviewquestions.docCorejavainterviewquestions.doc
Corejavainterviewquestions.docJoyce Thomas
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxssuser84e52e
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questionsVinay Kumar
 
Interface in Java
Interface in JavaInterface in Java
Interface in JavaDucat India
 
ch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdf
ch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdfch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdf
ch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdfbca23189c
 
12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.pptVISHNUSHANKARSINGH3
 
Dev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdetDev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdetDevLabs Alliance
 
Top 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDETTop 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDETDevLabs Alliance
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetdevlabsalliance
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 eehomeworkping9
 
Complete java&j2ee
Complete java&j2eeComplete java&j2ee
Complete java&j2eeShiva Cse
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview QestionsArun Vasanth
 
Java Core Parctical
Java Core ParcticalJava Core Parctical
Java Core ParcticalGaurav Mehta
 
Object Oriented Programming - Polymorphism and Interfaces
Object Oriented Programming - Polymorphism and InterfacesObject Oriented Programming - Polymorphism and Interfaces
Object Oriented Programming - Polymorphism and InterfacesHabtamu Wolde
 

Similar to 03_A-OOPs_Interfaces.ppt (20)

Core java questions
Core java questionsCore java questions
Core java questions
 
this keyword in Java.pptx
this keyword in Java.pptxthis keyword in Java.pptx
this keyword in Java.pptx
 
Corejavainterviewquestions.doc
Corejavainterviewquestions.docCorejavainterviewquestions.doc
Corejavainterviewquestions.doc
 
Interfaces
InterfacesInterfaces
Interfaces
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
 
Interface in Java
Interface in JavaInterface in Java
Interface in Java
 
ch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdf
ch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdfch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdf
ch4 foohggggvvbbhhhhhhhhhbbbbbbbbbbbbp.pdf
 
12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt
 
Java 06
Java 06Java 06
Java 06
 
Dev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdetDev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdet
 
The smartpath information systems java
The smartpath information systems javaThe smartpath information systems java
The smartpath information systems java
 
Top 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDETTop 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDET
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 ee
 
Complete java&j2ee
Complete java&j2eeComplete java&j2ee
Complete java&j2ee
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
 
Java Core Parctical
Java Core ParcticalJava Core Parctical
Java Core Parctical
 
Object Oriented Programming - Polymorphism and Interfaces
Object Oriented Programming - Polymorphism and InterfacesObject Oriented Programming - Polymorphism and Interfaces
Object Oriented Programming - Polymorphism and Interfaces
 

More from JyothiAmpally

1. Introduction to HTML5.ppt
1. Introduction to HTML5.ppt1. Introduction to HTML5.ppt
1. Introduction to HTML5.pptJyothiAmpally
 
01-basics-functions.ppt
01-basics-functions.ppt01-basics-functions.ppt
01-basics-functions.pptJyothiAmpally
 
02-Java Technology Details.ppt
02-Java Technology Details.ppt02-Java Technology Details.ppt
02-Java Technology Details.pptJyothiAmpally
 
01-Java Introduction.ppt
01-Java Introduction.ppt01-Java Introduction.ppt
01-Java Introduction.pptJyothiAmpally
 

More from JyothiAmpally (7)

1. Introduction to HTML5.ppt
1. Introduction to HTML5.ppt1. Introduction to HTML5.ppt
1. Introduction to HTML5.ppt
 
01-basics-functions.ppt
01-basics-functions.ppt01-basics-functions.ppt
01-basics-functions.ppt
 
25-functions.ppt
25-functions.ppt25-functions.ppt
25-functions.ppt
 
02-Java Technology Details.ppt
02-Java Technology Details.ppt02-Java Technology Details.ppt
02-Java Technology Details.ppt
 
01-Java Introduction.ppt
01-Java Introduction.ppt01-Java Introduction.ppt
01-Java Introduction.ppt
 
01_What is Java.ppt
01_What is Java.ppt01_What is Java.ppt
01_What is Java.ppt
 
Spring security
Spring securitySpring security
Spring security
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 

03_A-OOPs_Interfaces.ppt

  • 2. ● This module introduces patcipants to the java interface. ● Describes inheritence of interfaces ● creation of objects to interfaces. ● Abstract classes Module Overview 2
  • 3. Interface An interface is an abstract data type that defines a list of abstract public methods that any class implementing the interface must provide. An interface can also include a list of constant variables and default methods. •Interface is defined with the interface keyword. • Interfaces cannot be instantiated directly. • An interface is not required to have any methods and may not be marked as final. •All nondefault methods in an interface are assumed to have the modifiers abstract and public in their definition. • All top-level interfaces are assumed to have public or default access, and they must include the abstract modifier in their definition. •Marking an interface as private, protected, or final will trigger a compiler error, since this is incompatible with these assumptions.
  • 4. Interface //abstract method means unimplementation or no implementation public interface Person { public final static String country="India"; public abstract boolean isHospitalised();//unimplemented methods }
  • 5. Interface Variables Interface variables rules: 1. Interface variables are assumed to be public, static, and final. Therefore, marking a variable as private or protected will trigger a compiler error, as will marking any variable as abstract. 2. The value of an interface variable must be set when it is declared since it is marked as final.
  • 6. Interface Inheritence Inheritance rules when extending an interface: 1. An interface that extends another interface, as well as an abstract class that implements an interface, inherits all of the abstract methods as its own abstract methods. 2. The first concrete class that implements an interface, or extends an abstract class that implements an interface, must provide an implementation for all of the inherited abstract methods.
  • 7. Inheritence example //abstract method means unimplementation or no implementation public interface Person extends PhysicallyChallenged,Resident{ public final static String country="India"; public abstract boolean isHospitalised();//unimplemented methods }
  • 8. Default Method(java 8) A default method is a method defi ned within an interface with the default keyword in which a method body is provided. Contrast default methods with “regular” methods in an interface, which are assumed to be abstract and may not have a method body. A default method within an interface defi nes an abstract method with a default implementation. In this manner, classes have the option to override the default method if they need to, but they are not required to do so. If the class doesn’t override the method, the default implementation will be used.
  • 9. Default Method Example public interface IsAdmitted{ boolean hasInsurance(); public default double getBill() { return 1000.0; } } Note:- methods of an interface are always public.
  • 10. Default method rules 1. A default method may only be declared within an interface and not within a class or abstract class. 2. A default method must be marked with the default keyword. If a method is marked as default, it must provide a method body. 3. A default method is not assumed to be static, final, or abstract, as it may be used or overridden by a class that implements the interface. 4. Like all methods in an interface, a default method is assumed to be public and will not compile if marked as private or protected.
  • 11. Static methods in Interface(java 8) Static methods are defi ned explicitly with the static keyword. There is one distinction between a static method in a class and an interface. A static method defi ned in an interface is not inherited in any classes that implement the interface. Here are the static interface method rules you need to be familiar with: 1. Like all methods in an interface, a static method is assumed to be public and will not compile if marked as private or protected. 2. 2. To reference the static method, a reference to the name of the interface must be used.
  • 12. Static Method Example public interface Discharge{ static int no_Of_Days_Admit() { return 10; } }
  • 13. Polymorphism Polymorphism is a oops feature in which the property of an object takes on many different forms. No of ways polymorphism achieved: Java object may be accessed using a reference with the same type as the object . Reference that is a superclass of the object, Reference that defi nes an interface the object implements, either directly or through a superclass. Explicit cast is not required if the object is being reassigned to a super type or interface of the object

Editor's Notes

  1. Instructor Notes: