0% found this document useful (0 votes)
16 views7 pages

Understanding Java Polymorphism Concepts

The presentation by Md Robiul Islam discusses the concept of polymorphism in Java, explaining it as having many forms. It covers two types of polymorphism: compile-time (method overloading) and run-time (method overriding), providing examples for each. The document concludes with a thank you note to the audience.

Uploaded by

greenlouisa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Understanding Java Polymorphism Concepts

The presentation by Md Robiul Islam discusses the concept of polymorphism in Java, explaining it as having many forms. It covers two types of polymorphism: compile-time (method overloading) and run-time (method overriding), providing examples for each. The document concludes with a thank you note to the audience.

Uploaded by

greenlouisa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Java

Programming
Presentation
Md Robiul Islam
ID:22111102
Dept of CSE,BSFMSTU.
What is
Polymorphism ?
Poly
morphism
Many Forms
Examples of Polymorphism

Teache Studen
r t
Me

Friend

Same Objects Having Different


Behavior
Types of Polymorphism

Compile Time Run-Time

Method Method
Overloading Overriding
Method Overloading
public class A {
Whenever a class contain more
void add()
{ then one method with same
int a=10,b=20,sum=0; name and different type of
sum=a+b; parameters .
[Link](sum);
}
void add(int x,int y)
{
int sum=0; public static void main(String[] args) {
sum=x+y; A r= new A();
[Link](sum); [Link](); [Link](40, 50);
} [Link](50,45.32 );
void add(int x, double y) }
{
}
double sum=0;
sum=x+y; //Output:
[Link](sum); 30
}
90
94.32
Method Overriding
class shape{
Whenever we writing method in
void draw(){ super and sub classes in such a
way that method name and
[Link]("Can't say shape
type");
parameter must be same.

}
public class B {
} public static void main(String[] args)
class square extends shape{
{
@Override shape s = new square();
void draw() { [Link]();
}
[Link]();
[Link]("Square"); }
//Output :
}
}
Can't say shape type
Square
Thank You
All

You might also like