aspose file tools*
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
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 />
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reference Variable