This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "var-args doubt clarification needed" Watch "var-args doubt clarification needed" New topic

var-args doubt clarification needed

asha parek

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

Joined: Feb 24, 2006
Posts: 6662

Welcome to JR

Please QuoteYourSources

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
I agree. Here's the link:
subject: var-args doubt clarification needed
It's not a secret anymore!