questions for dynamic binding and signature method in java ab -


matching method signature , binding method implementation 2 sepearate issue ,what's wrong follows code?

container c5 = new jbutton();  object c6 = new jbutton();  c5.add(c6);       //----it wrong,why? 

for me , c5 reference variable contain reference object of jbutton,and jbutton extends class component,so should right why ?

java single-dispatch language. means method signature analysis done @ compile time, not run time.

the type of c6 object. (yes, assign jbutton, declared type of variable still object.) when java looks @ c5 (a container) , methods, doesn't see add() method takes object. flags error.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -