File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 18541
    
    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: 438

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%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
 
Don't get me started about those stupid light bulbs.
 
subject: var-args
 
Similar Threads
i am getting identifier expected error in line 4... can any one help me out
printing and returning arrays
object ref assignment conversion
SCJP help
cant retrieve data.