my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes var-args doubt clarification needed 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 doubt clarification needed" Watch "var-args doubt clarification needed" New topic
Author

var-args doubt clarification needed

asha parek
Greenhorn

Joined: Sep 07, 2011
Posts: 6

The test question is:
Which, inserted independently at line 6, will compile? (Choose all that apply.)
A. static void doStuff(int... doArgs) { }
B. static void doStuff(int[] doArgs) { }
C. static void doStuff(int doArgs...) { }
D. static void doStuff(int... doArgs, int y) { }
E. static void doStuff(int x, int... doArgs) { }


Why option D is not correct?
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
Ashwini Welcome to the Ranch

Option D is not correct because varargs parameter should be the last parameter.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Welcome to JR

Please QuoteYourSources


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
 
subject: var-args doubt clarification needed
 
Similar Threads
array
New type of var-args syntax (at least to me)
Gotcha: Varargs spoofs method signature [from Sierra/Bates book]
varargs doubt
DOUBT from scjp book