aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes var-args 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 "var-args" Watch "var-args" New topic
Author

var-args

swaraj gupta
Ranch Hand

Joined: Oct 22, 2010
Posts: 181

Output: 14
Why so..?

How would you read this "int[]..a" ?
Well var-arg is one of my weakest point, I faced same sort of problems when I was going through advanced overloading. How should I fix it..? Please suggest something..
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

You pass two parameters to the go() method. What are they? And then the go() method prints... what?
swaraj gupta
Ranch Hand

Joined: Oct 22, 2010
Posts: 181

Paul Clapham wrote:You pass two parameters to the go() method. What are they? And then the go() method prints... what?

Just know one thing here that we are passing references of one-dimensional int type array objects to go method.
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

Swaraj
even var-args was obstacle in my preparation
but it is simple
look you have to just remember some rules

with var-args as method arguments, we can pass either array or various arguments to the method



so the answer is 14

hope this helps

SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: var-args