aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes variable-arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "variable-arguments" Watch "variable-arguments" New topic
Author

variable-arguments

akshay dev
Greenhorn

Joined: Nov 08, 2012
Posts: 19
hi,
can anyone tell me the declaration rules for var-args. i currently have sierra and bert scjp 6.0 guide
but its written in somewhat i really can't understand.
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1509
    
    5

akshay dev wrote:hi,
can anyone tell me the declaration rules for var-args. i currently have sierra and bert scjp 6.0 guide
but its written in somewhat i really can't understand.

Welcome to CodeRanch!

Can you be a little more specific about what is exact part you are finding difficult to understand? Also, you can refer Java Language Specification.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
akshay dev
Greenhorn

Joined: Nov 08, 2012
Posts: 19
i didn't understood " the var-args must be the last parameter in the method's signature , and you can have only one var-arg in a method ".
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 176
Hi Ashkay

The following may help with your understanding of var-args Variable-Length Arguments


Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

akshay dev wrote:i didn't understood " the var-args must be the last parameter in the method's signature


That means this:




, and you can have only one var-arg in a method ".


That means this:


I think the reason for these rules is that it makes it a lot easier for the compiler to match a signature when we call foo(arg1, arg2, arg3, arg4, arg5) if it knows that only the last arguments can possibly go with a varargs parameter. If these rules weren't in place, there would be a lot more potentially valid signature that could match and it would be difficult or impossible for the compiler do determine which one was correct.

akshay dev
Greenhorn

Joined: Nov 08, 2012
Posts: 19
thank you all
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: variable-arguments