y does a.foo("test") call the method with var arg parameter and not the other foo method ?
posted 7 years ago
this is because in case of variable parameters , the compiler has no way to understand that you want variable-number-of-string function or the single-string function to be executed. you are having the reference variable of the super class. just like foo(String... args,int x) is not valid as one cant understand when this variable list will finish so if you think just for a second from the compiler's perspective.. you will get it !
A computer once beat me at chess, but it was no match for me at kick boxing.<br />