1)Static Polymorphism
Method overloading
methods overloaded in class with same name, but different datatype and no of argument
int test(int a, intb);
double test(double y);
2)Dynamic Polymorphism
Method overriding
Overriding the method of parent class.
class A{
int method (int x){}
}
class B extends A{
int method (int x){}
}
All the interfaces are example of method overriding
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment