-4

I am a bit confused with the binding type of a constructor. Why is calling

Canvas c = new Circle(); not dynamic binding?

Thank you!

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
  • see here about static binding and dynamic binding - http://beginnersbook.com/2013/04/java-static-dynamic-binding/ – Razib Jan 08 '16 at 18:34
  • Because it is absolutely and explicitly clear *at compile time* that a certain constructor of class Circle is being called. – laune Jan 08 '16 at 18:34
  • http://javaconceptoftheday.com/static-binding-and-dynamic-binding-in-java/ – ryekayo Jan 08 '16 at 18:35

1 Answers1

0

It is static binding as it is done during compile time.

If class Circle has a method that overrides a method from Canvas and you call that method like the following, then it is called dynamic binding.

//if you override some method in the child class that is Circle 
c.someMethod() //example of dynamic binding 

You can read static vs dynamic for more.

Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108