filmov
tv
What is Compile Time Polymorphism in JAVA | Most Important Interview Question | OOPS Concept #java

Показать описание
I TRY TO GIVE MY BEST.
Compile Time Polymorphism in Java.
Why overloading is called compile time polymorphism?
With overloading you have a function with different sets of parameters. The function that is executed is determined using the number and type of the parameters you provide. As these are known at compile time, the compiler already determines the function to use. Because of this, it is called compile time polymorphism.
There are two types of polymorphism which are the compile-time polymorphism (overload) and run-time polymorphism (overriding).
Compile Time Polymorphism in Java.
Why overloading is called compile time polymorphism?
With overloading you have a function with different sets of parameters. The function that is executed is determined using the number and type of the parameters you provide. As these are known at compile time, the compiler already determines the function to use. Because of this, it is called compile time polymorphism.
There are two types of polymorphism which are the compile-time polymorphism (overload) and run-time polymorphism (overriding).