Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What is the difference between compile-time polymorphism and runtime polymorphism?
Home
JAVA
What is the difference between compile-time polymorphism and runtime polymorphism?
0
votes
asked
Apr 30, 2021
in
JAVA
by
rajeshsharma
What is the difference between compile-time polymorphism and runtime polymorphism?
#polymophism
un-time-polymorphism
Java-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Apr 30, 2021
by
rajeshsharma
There are the following differences between compile-time polymorphism and runtime polymorphism.
SN
compile-time polymorphism
Runtime polymorphism
1
In compile-time polymorphism, call to a method is resolved at compile-time.
In runtime polymorphism, call to an overridden method is resolved at runtime.
2
It is also known as static binding, early binding, or overloading.
It is also known as dynamic binding, late binding, overriding, or dynamic method dispatch.
3
Overloading is a way to achieve compile-time polymorphism in which, we can define multiple methods or constructors with different signatures.
Overriding is a way to achieve runtime polymorphism in which, we can redefine some particular method or variable in the derived class. By using overriding, we can give some specific implementation to the base class properties in the derived class.
4
It provides fast execution because the type of an object is determined at compile-time.
It provides slower execution as compare to compile-time because the type of an object is determined at run-time.
5
Compile-time polymorphism provides less flexibility because all the things are resolved at compile-time.
Run-time polymorphism provides more flexibility because all the things are resolved at runtime.
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
0
votes
Q: How can one implement the compile-time Polymorphism in the C++ programming language?
asked
Jan 24, 2021
in
JAVA
by
rajeshsharma
polymorphism
inheritance
java
c
-object-oriented-language
Java-questions-answers
0
votes
Q: Can you achieve Runtime Polymorphism by data members?
asked
Apr 30, 2021
in
JAVA
by
rajeshsharma
#runtime-polymorphism
polymorphism
java
Java-questions-answers
0
votes
Q: Explain What is Runtime Polymorphism?
asked
Apr 30, 2021
in
JAVA
by
rajeshsharma
runtime-polymorphism
polymorphism
java
Java-questions-answers
0
votes
Q: How can one implement the run-time Polymorphism in the C++ programming language?
asked
Jan 24, 2021
in
JAVA
by
rajeshsharma
polymorphism
run-time-polymorphism
c
-programming
Java-questions-answers
+1
vote
Q: What is a compile time constant in Java? What is the risk of using it?
asked
Jan 24, 2020
in
JAVA
by
rahuljain1
#java-constant
Java-questions-answers
0
votes
Q: What is the difference between preemptive scheduling and time slicing in Java?
asked
May 30, 2020
in
JAVA
by
Robindeniel
#java-preemptive
#java-scheduling
#java-time-slicing
#time-slicing-java
#preemptive-scheduling-java
Java-questions-answers
+1
vote
Q: Select the best from following options correctly explains the concept of Polymorphism?
asked
Jan 24, 2021
in
JAVA
by
rajeshsharma
#polymorphism
java-features
oops
Java-questions-answers
0
votes
Q: What is polymorphism in java?
asked
Oct 18, 2020
in
JAVA
by
sharadyadav1986
#polymorphism-in-java
#java-polymorphism
Java-questions-answers
0
votes
Q: What is Polymorphism in java
asked
Jun 15, 2020
in
JAVA
by
Robindeniel
#java-polymorphism
#polymorphism-java
Java-questions-answers
+1
vote
Q: What is Polymorphism?
asked
May 24, 2019
in
JAVA
by
rajeshsharma
#java
#javainterview
#javaanswer
#javaquestionanswer
#javaquestion
Java-questions-answers
...