Easy learning with example program codes

what is the difference between static binding and dynamic binding in java?

  Static binding  Dynamic binding
  1. Static binding in Java occurs during compile time.
  2. private, final and static methods and variables use static binding and are bonded by compiler Must not have any explicit return type.
  3. Static binding uses Type information  i.e. class in Java, for binding.
  4. Overloaded methods are bonded using static binding
  1. Dynamic binding occurs during runtime.
  2. virtual methods are bonded during runtime based upon runtime object.
  3. dynamic binding uses object to resolve binding.
  4. overridden methods are bonded using dynamic binding at runtime.
Please follow and like us:

Copyright © 2020 CodesJava Protection Status