-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!

3
  • see here about static binding and dynamic binding - beginnersbook.com/2013/04/java-static-dynamic-binding Commented Jan 8, 2016 at 18:34
  • Because it is absolutely and explicitly clear at compile time that a certain constructor of class Circle is being called. Commented Jan 8, 2016 at 18:34
  • javaconceptoftheday.com/… Commented Jan 8, 2016 at 18:35

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.