"polymorphism can be acheived two ways
overloading - static binding/early binding
overriding - dynamic binding/late binding
in case of overloading, you will have same method names with different signatures within a class.
display(char arr, int sub)
display(char arr, char subarr)
display(char arr,char subarr,int sub)
NOTE: return type is not considered. only the method parameters should be different. here, the method to be called is decided at the compile time itself, based on the signature.
in case of overriding, a simple example would be of inheritance. in case of inheritance, you have a baseclass/interface and subclasses. here, the method signature (which also can have a method body), exists in base class and same method (without modifying the signature) exists in the subclass also.
interface figure -> draw()
class triangle implements figure -> draw()
class polygon implements figure -> draw()
above you can see an interface which has a method draw() and same has been implemented in triangle and polygon (you can have a base class and do extends also). since the reference of a derived class object can be assigned to a base class reference (OOP concept), you can create objects of triangle and polygon and assign it to the interface reference"