This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reference Variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reference Variable" Watch "Reference Variable" New topic
Author

Reference Variable

Sid Robin
Ranch Hand

Joined: Nov 24, 2007
Posts: 53


y does a.foo("test") call the method with var arg parameter and not the other foo method ?
vaibhav srivastava
Greenhorn

Joined: Feb 24, 2008
Posts: 14
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 />
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Reference Variable
 
Similar Threads
Please explain how output of this program came?
Please explain this
VarArgs
String argument giving two different outputs ?
what is the Difference between method overriding and redefining