What is the difference between static binding and dynamic binding? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What is the difference between static binding and dynamic binding?

28th Sep 2017, 1:48 AM
Yatin Nayyar
Yatin Nayyar - avatar
2 Answers
+ 3
I don't think I could answer this question better than the top answers found on Stack Overflow: - https://stackoverflow.com/questions/19017258/static-vs-dynamic-binding-in-java --------------------------------------------------- - Excerpt from the Selected Answer: ---------------------------------------------- 1) Static binding in Java occurs during Compile time while Dynamic binding occurs during Runtime. 2) private, final and static methods and variables uses static binding and bonded by compiler while virtual methods are bonded during runtime based upon runtime object. 3) Static binding uses Type(Class in Java) information for binding while Dynamic binding uses Object to resolve binding. 4) Overloaded methods are bonded using static binding while overridden methods are bonded using dynamic binding at runtime. ---------------------------------------------- I do recommend you review the various other posted answers and code examples. Although I cannot take credit for this answer, I hope it was helpful.
28th Sep 2017, 2:49 AM
David Carroll
David Carroll - avatar
- 1
himawari
2nd Oct 2017, 3:47 AM
musubimaru